A shift instruction commonly found in the high level programming language such as C. Here in the PLC ladder diagram they include a circular shift instruction that support a carry bit.
Circular shift left and right
The shift operation works in two directions - right and left. After the shift operation the data just change its position but all bits will not lost their value.
The operation of these two instructions
When the input to these instruction is true it start its circular shift operations with any specific position. The position is set in the operand2 of instruction property.
The circular shift left ROL instruction property
The circular shift right ROR instruction property
For a simple example I use these two instruction to chase the LEDs.
Ladder diagram example
PIC16F876 uses most of its I/O pins to output the LED chasing.
Schematic Diagram
Click here to see the folder of this working ladder diagram example.
No comments:
Post a Comment