Many a times it happens that we require to transfer a series of DM words in plc program to other DM words , so instead of writing a single MOV instruction everytime we can use a advanced Instruction XFER to transfer a complete block of DM words from one location to another. Also we will discuss one more instruction XFRB through which we can transfer the bit status from one word to another.
How to Move more than one DM Word in a Single Instruction :-
There is one instruction in omron plc through which we can transfer a more than one Dm word at a time. XFER is the instruction through which we can move up to 65,535 words from one place to another, But all the DM should be in sequential order.
Syntax :- XFER A B C
where A is number of words which you want to move, B is the source starting word and C is the destination first word. See the below example :-
Example :- XFER &10 D100 D200
When this instruction is executed than 10 words starting from D100 will be moved to D200. That is D100 to D109 data will be copied to D200 to D209.
This instruction proves to be very usefull inn the case of Modbus Programming where we have to transfer the whole query in to Modbus DM words.
Transfering Bit Status from One Place to Another :-
Sometimes it is also required in the plc programming that we need to move the bit status from one word to another. So for this purpose we have got one instruction in Omron PLC. XFRB is the Instruction , see its syntax below:-
XFRB A B C
where A is the control word , A is the source word and B is the destination Word.
The value in the control word decides that how many bits will be moved and in which way. The first first four Bits in Control Word will decide which will be starting Bit to be moved , the next four bits will decide the first bit in destination word and the last 8 bits will tell about the number of Bits to be copied. See below example for better understanding.
Example :- XFRB D100 W6 W7 ( D100 = 1426)
So when this instruction is executed than the 20 bits starting from w6.6 will be copied to bits starting from w7.2 , here the control word is D100= 1426 which means that 6 is the starting bit in source word and 2 is the starting bit in Destination word.
We hope that with the use of above instructions in your PLC program you can reduce the length of plc program. Also you can subscribe to get all latest updates in omrom plc programming.Subscribe to Automation-Talk by Email.
Advertisements :-
How to know D100=1426?
ReplyDelete