9 programmable i/o, Digital outputs – Yaskawa SMC–4000 User Manual
Page 348
338
SMC–4000 User Manual
9 Programmable I/O
Digital Outputs
Each bit on the output port may be set and cleared with the software instructions SB (Set Bit) and
CB(Clear Bit), or OB (define output bit).
Example:
The Output Bit (OB) instruction is useful for setting or clearing outputs depending on the value of a
variable, array, input or expression. Any non-zero value results in a set bit.
The output port may also be written to as an 8-bit word using the instruction
OP (Output Port). This instruction allows a single command to define the state of the entire 8-bit output
port, where 2
0
is output 1, 2
1
is output 2 and so on. A 1 designates that output is on.
Example:
The output port is useful for firing relays or controlling external switches and events during a motion
sequence.
Instruction
Function
SB3
Sets bit 3 of output port
CB4
Clears bit 4 of output port
Instruction Function
OB1, POS
Set Output 1 if the variable POS is non-zero. Clear Output 1 if
POS equals 0.
OB 2, @IN [1]
Set Output 2 if Input 1 is high. If Input 1 is low, clear Output 2.
OB 3, @IN [1]&@IN [2]
Set Output 3 only if Input 1 and Input 2 are high.
OB 4, COUNT [1]
Set Output 4 if element 1 in the array COUNT is non-zero.
Instruction
Function
OP6
Sets outputs 2 and 3 of output port to high. All other bits are 0.
(2
1
+ 2
2
= 6) (1100 binary)
OP0
Clears all bits of output port to zero
OP 15
Sets all bits of output port to one.
(2
0
+ 2
1
+ 2
2
+ 2
3
) (1111 binary)