We have different types of data in our program which is used as our requirement. As we discussed in previous blog we have different logic which can be used for better program.
Please study ladder logic function blog then study plc data handling to get better concept of it.
We are starting with Move Function
If a data is shifted from one location to another location then it is known as moving of that data and function which operates it is called move function.
There are two basic types of move functions
- MOV (Value, Destination) : moves value to memory location
- MVM (Value, Mask, Destination) : moves a value to a memory location , but with a mask to select specific bits.
The simple move (MOV) will take a value from one location in memory and place it in another location. Eg:
When A is true the MOV function moves a floating point number from source to destination address. The data in source address is left unchanged. When B is true the floating point number in the source will be converted to an integer and stored in destination address in integer memory. The floating point number will be rounded up or down to the nearest integer. When C is true integer value, 123 will be placed in integer file N7:23.
A more complex type example gives you idea of Both MOV and MVM.Eg
When A becomes true the first move statement will move value of 130 into N7:0. And the second move statement will move the value of -9385 from N7:1 to N7: 2 ( The number shows negative cause it is showing 2s compliment). For simple MOV, the binary values are not needed, but for the MVM statement the binary values are essential. The statement moves the binary bits from N7:3 to N7:5, but only those bits that are also on in the mask N7:4, other bits in the destination will be left untouched. Notice that the first bit N7:5 is true in the destination address before and after, but it is not true in the mask. The MVM function is very useful for applications where individual binary bits are to be manipulated, but they are less useful when dealing with actual number values.
The data result of eg…
Before
|
After
| ||||||
Binary
|
Decimal
|
Binary
|
Decimal
| ||||
N7:0
|
0000000000000000
|
0
|
0000000010000010
|
130
| |||
N7:1
|
1101101101010111
|
9385
|
1101101101010111
|
9385
| |||
N7:2
|
1000000000000000
|
32768
|
1101101101010111
|
9385
| |||
N7:3
|
0101100010111011
|
22715
|
1101100010111011
|
10053
| |||
N7:4
|
0010101010101010
|
10922
|
0010101010101010
|
10922
| |||
N7:5
|
0000000000000001
|
1
|
0000100010101011
|
2219
| |||
N7:6
|
1101110111111111
|
1101110111111111
|
Tomorrow we will study next logic.
No comments:
Post a Comment