hapetter
Member
Hi.
I try to understand how to read an analog input (4-20mA). Using TwinCAT.
I found this example on how to scale the input into engineering units:
Eksempel
0-60 bar fra 4-20 mA resolution 0.1 bar:
FACTOR = 10
Data @ 4 mA = 6240
Data @ 20 mA = 31208
DataOffset = 6240
DataSpan = 31208 - 6240 = 24968
EUOffset = 0 x 10 = 0
EUSpan = (60 - 0) x 10 = 600
DATA = 18975
EU = ((600 x (18975 - 6240)) / 24968) + 0 = 306
Process value = 306 / 10 = 30.6 bar
Best Regards
Hans Pettersson
I try to understand how to read an analog input (4-20mA). Using TwinCAT.
I found this example on how to scale the input into engineering units:
Eksempel
0-60 bar fra 4-20 mA resolution 0.1 bar:
FACTOR = 10
Data @ 4 mA = 6240
Data @ 20 mA = 31208
DataOffset = 6240
DataSpan = 31208 - 6240 = 24968
EUOffset = 0 x 10 = 0
EUSpan = (60 - 0) x 10 = 600
DATA = 18975
EU = ((600 x (18975 - 6240)) / 24968) + 0 = 306
Process value = 306 / 10 = 30.6 bar
- Is this a good approach?
- How to set up VAR types?
- All variables of types word?
- Should FACTOR allways be 10?
- Is DATA buffer (12bit) a value between 0-32000?
Best Regards
Hans Pettersson