I'm using a pressure sensor that outputs 4-20mA related to a pressure of 0-250 bar. There is an example for a sensor in the manual which states that I should put the sensor range "4-20 mA" in the IN_MIN and IN_MAX respectively.I tried this but I got great errors in the reading
The resolution of the A/D of the DUO PLC is 12 bits, shall I put 0 in the IN_MIN and 4095 in the IN_MAX
Waiting for your reply.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using a pressure sensor that outputs 4-20mA related to a pressure of 0-250 bar. There is an example for a sensor in the manual which states that I should put the sensor range "4-20 mA" in the IN_MIN and IN_MAX respectively.I tried this but I got great errors in the reading
The resolution of the A/D of the DUO PLC is 12 bits, shall I put 0 in the IN_MIN and 4095 in the IN_MAX
Waiting for your reply.
In ST you could do it like this:
Pressure := analogValue * 250 / 4095;
this answer is wrong
the bits are in different place.
check your analog card for this, mine begin at 7 (bits are shifted) and stop at 4095-7.
to scale use simple math like y=a+bx
b = 250/ 4081
and a=0 for a normal 4/20 mA card.
stay as long as possible in INTeger for speed calcs.