Success!
for anyone attempting this for themselves, i'll outline the params that need to be changed and post my code below.
This allows you to run your main program from the memory card (or another source) and communicate via com port with the indexer.
params
param:110 bit:0 must be 1 This separates the input and output channels, allowing you to use params 21-23
param:21 changed to channel 1 in macro then back to 4 at end. change this to suit.
param:6006 bit:0 must be 1 This allows use of logical expressions in your macro
param:6001 bit:1 must be 1 Leaves leading zeroes as zeroes (instead of a space)
param:6001 bit:4 must be 1 outputs CF after data output (for hardinge controller comms)
param:6001 bit:6 must be 1 Clear custom macro variables 100-149 on reset
param:3404 bit:6 must be 1 prevents end of record alarm when M99 is read
to set up the macro as an M code (I used M50)
1)in mdi mode press offset/settings button, then seting soft key, change parameter write=1
2)change param 3202 bit 4 to 0 to edit 9000 series programs
3)change parameter write back to 0, hit reset
4)if no program in o9020 spot, save program as o9020 in controller memory
5)change parameter write back to 1, then param 3202 bit 4 back to 1, locking 9000 series programs
6)change param 6080 to 50 (or whichever empty M code you are using)
7)change parameter write back to 0, locking parameters
and here's my final code:
when outputting zero with 3 digits before and after the decimal (required by the hardinge controller) you still get 0 (instead of 000.000), hence the homing condition instead of just outputting 000.000
code
(A MACRO TO SIMPLIFY THE USE OF A HARDINGE ROTARY INDEXER)
(CALLS AN 'S' ARGUMENT AS #19)
(USES FIXED ROTARY SPEED OF 300 DEG/SEC. PROGRAM USES ABSOLUTE ANGLES ONLY.)
(-----------------------------------------------)
(USER DEFINED VALUES)
(#19=S) (CALLED VARIABLE. SENT FROM MASTERCAM)
#101=4 (I/O CHANNEL YOURE STARTING FROM)
#102=1 (I/O CHANNEL THAT INDEXER IS CONNECTED TO)
(-----------------------------------------------)
#100=#19
IF[[#100LE360]AND[#100GE0]]GOTO10 (CHECK THAT ANGLE IS POSSIBLE)
#3000=101
N10
G10 L50 (NEW I/O CHANNEL)
N21 R#102
G11
POPEN (OPEN PORT)
DPRNT[] (CLEAR BUFFER)
G04 P64
IF[[#100EQ0]OR[#100EQ360]]GOTO25 (HOME)
DPRNT[XG090] (SET TO ABSOLUTE)
G04 P64
DPRNT[XF300.000] (SET FEEDRATE TO 300)
G04 P64
DPRNT[XS#100[33]] (SET ANGLE TO S ARG)
G04 P64
M12 (FIRE TRIGGER)
G04 P1500
M13 (CANCEL TRIGGER)
DPRNT[]
PCLOS (CLOSE PORT)
G10 L50 (SET IO CHANNEL TO ORIGINAL)
N20 R#101
G11
M99 (END SUBPROGRAM)
(-----------------------------------------------)
(IN CASE OF S=0)
N25
DPRNT[XG088] (GO HOME)
G04 P64
DPRNT[XF300.000] (SET FEEDRATE TO 300)
G04 P64
M12 (FIRE TRIGGER)
G04 P1500
M13 (CANCEL TRIGGER)
DPRNT[]
PCLOS (CLOSE PORT)
G10 L50 (SET IO CHANNEL TO ORIGINAL)
N21 R#101
G11
M99 (END OF SUBPROGRAM)
usage
simply call it as M50 S180 (or whichever angle you want) from within mastercam (i use manual input)