Stamp PLC Code for 4-20mA
Kye
Posts: 2,200
Hello,
I've currently been working on using the Parallax PLC with 4 - 20 ma current loop signals and I've been having some problems.·I'm using the OMEGA PX605 - 1kg pressure sensor with the MAX1270 ADC reading the voltage in the·Stamp PLC.
So far I've gotten correct readings within a certain range... but as I increase the pressure (what the sensor is reading), the value read is incorrect.
I've called tech support at OMEGA and they said that the sensor has a linear scale from 4 - 20 ma. I've also confirmed that the sensor works correctly with other pressure reading systems from OMEGA.
So, I did some rsearch online that said, to properly use a 4 - 20 ma signal a 250 OHM resistor must be shunted across the sensor output and the ADC input. And that the ADC should be configured to read 0 - 5 VDC.
And the Stamp PLC reflects this...
So I would like help with the code that should be implemented to correctly read the ADC 4 - 20 ma loop. Since the Stamp PLC says it supports this, I am assuming the hardware is correct.
Post Edited By Moderator (Chris Savage (Parallax)) : 2/6/2008 9:36:49 PM GMT
I've currently been working on using the Parallax PLC with 4 - 20 ma current loop signals and I've been having some problems.·I'm using the OMEGA PX605 - 1kg pressure sensor with the MAX1270 ADC reading the voltage in the·Stamp PLC.
So far I've gotten correct readings within a certain range... but as I increase the pressure (what the sensor is reading), the value read is incorrect.
I've called tech support at OMEGA and they said that the sensor has a linear scale from 4 - 20 ma. I've also confirmed that the sensor works correctly with other pressure reading systems from OMEGA.
So, I did some rsearch online that said, to properly use a 4 - 20 ma signal a 250 OHM resistor must be shunted across the sensor output and the ADC input. And that the ADC should be configured to read 0 - 5 VDC.
And the Stamp PLC reflects this...
So I would like help with the code that should be implemented to correctly read the ADC 4 - 20 ma loop. Since the Stamp PLC says it supports this, I am assuming the hardware is correct.
Post Edited By Moderator (Chris Savage (Parallax)) : 2/6/2008 9:36:49 PM GMT
Comments
http://www.parallax.com/Portals/0/Downloads/docs/prod/indl/StampPLC.pdf
http://pdfserv.maxim-ic.com/en/ds/MAX1270-MAX1271B.pdf
Post Edited (PJ Allen) : 2/7/2008 2:27:52 AM GMT
Now, my problem really was caused by me not implementing a conversion factor on the ADC.
To keep it short, I need to implement the equation...
x = (5/4096) * ((b - a) / 5) * U
Where x is the pressure reading
Where b is the maximum pressure reading (1000) - Leaving the equation open for other 4 - 20 ma circuits
Where a is the minimum pressure reading (0) - Leaving the equation open for other 4 - 20 ma circuits
Where U is the value produced by the ADC
...
My problem is representing (5/4096) = 0.001220703125
I need to use the full number, or I'll have to sacrifice accuracy. Is there any way of doing so? And if so what is the most compact and code efficent way?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Post Edited (Kye) : 10/24/2008 4:01:14 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Shawn Lowe
Maybe I should have waited to do that......