Macro Language In_Outputs
Valid for S300, S700
Digital Inputs and Outputs
If a digital input is used in a macro program it must not have a firmware function assigned:
INxMODE 0
If a digital output is used in a macro program it must have assigned the output function 23, "Slot-DPR":
OxMODE 23
The inputs and outputs will be addressed with INPUTx and OUTPUTx. Example:
IF INPUT3=1 THEN // if digital input 3 is active
OUTPUT1:=1; OUTPUT2:=0; // switch output 1 on and output 2 off
END_IF;
Virtual Inputs
It is possible to assign standard I/O functions to the virtual inputs (input5...20 if no I/O option card is used) and change the inputs in a macro program. This way it is possible to use standard ready made functions with a macro program.
Inputs can be changed using th emacro SOFTIN. Bit 0 is for input 5, bit 6 for input 6 and so on.
In the following example virtual input 7 has been configured with function 16, "start motion task". With IN7TRIG = 0 the input 7 is used to start the reference move.
SOFTIN:=SOFTIN|0x04; // set (virt.) Input7 to start reference move
SOFTIN:=SOFTIN&0xFFFFFFFB; // set Input 7 back to 0
Digital I/Os on the Expansion Card I/O -14/08
If an expansion card I/O14/08 is being used the additional I/Os can also be used in a macro program. To use them as general purpose I/Os set the according
INxMODE 0 and
OxMODE 23.
Macro names for the inputs and outputs can be seen in the following tables:
Input | X11A Pin | Makro |
---|---|---|
A0 | 1 | INPUT11 |
A1 | 2 | INPUT12 |
A2 | 3 | INPUT13 |
A3 | 4 | INPUT14 |
A4 | 5 | INPUT15 |
A5 | 6 | INPUT16 |
A6 | 7 | INPUT17 |
A7 | 8 | INPUT18 |
Reference | 9 | INPUT5 |
FError_clear | 10 | INPUT6 |
Start_MT Next | 11 | INPUT7 |
))Start_Jog(( v=x | 12 | INPUT8 |
MT_Restart | X11B Pin1 | INPUT9 |
Start_MT No. x | Pin2 | INPUT10 |
To read the inputs as byte use the byte macro variables SLOTX1 and SLOTX2.
Example:
TEMPVAR:=SLOTX2&0XFF; //Read Inputs 11 to 18 into LONG variable TEMPVAR
TEMPVAR1:=SLOTX1&0X3F; //Read Inputs 5 to 10 into LONG variable TEMPVAR1
Output (Default Function) | X11B Pin | Macro |
InPos | 3 | OUTPUT3 |
Next-InPos | 4 | OUTPUT4 |
/SFAULT | 5 | OUTPUT5 |
Sw_limit 1 | 6 | OUTPUT6 |
Sw_limit 2 | 7 | OUTPUT7 |
PosReg3 | 8 | OUTPUT8 |
PosReg4 | 9 | OUTPUT9 |
PosReg5 | 10 | OUTPUT10 |
Analog Inputs
Analog inputs are read using the macro variables ANIN1 and ANIN2.
Scaling: +/-10Volts = +/-8192 Increments
Example for conversion to millivolts:
LONG TEMPVAR1, MILLIVOLT;
LONG CONST10T:=10000;
LONG CONST13BIT:=8192;
TEMPVAR1:=ANIN1; // voltage in incr., conversion from word to double word
MULDIV(TEMPVAR1,CONST10T,CONST13BIT,MILLIVOLT); //MILLIVOLT=ANIN1*10000 / 8192