
DavidG (Customer) asked a question.
I have a P1AM connected to a P1-04AD analog input module and have a 2 wire 4-20mA pressure gauge hooked up to channel 2 per the data sheet. For some reason, I continue to get a reading of zero even though I've verified the presence of a 5mA signal coming off the gauge. I assume I'm missing something simple here but I cannot figure it out. Code is slightly modified P1AM analogInput example sketch .
- #include <P1AM.h>
-
- int inputCounts = 0; //Reading in Counts
- float MilliAmps = 0; //Reading in Volts
-
- void setup(){ // the setup routine runs once:
-
- Serial.begin(115200); //initialize serial communication at 115200 bits per second
- while (!P1.init()){
- ; //Wait for Modules to Sign on
- }
- char P1_04AD_CONFIG[] = { 0x40, 0x03, 0x00, 0x00, 0x20, 0x03, 0x00, 0x00, 0x21, 0x03, 0x00, 0x00, 0x22, 0x03, 0x00, 0x00, 0x23, 0x03 };
- P1.configureModule(P1_04AD_CONFIG, 1);
- }
-
- void loop(){ // the loop routine runs over and over again forever:
-
- // inputCounts = P1.readAnalog(1, 2); //Reads analog data from slot 1 channel 2 of the analog input module
- // MilliAmps = map(inputCounts, 0, 65535, 0, 20.0 );
- // Serial.println("Channel 2 is reading: ");
- // Serial.print(MilliAmps,2); //Print the value in Volts up to 2 decimal places
- // Serial.println("mA");
- // Serial.print(inputCounts); //Print the value in counts
- // Serial.println(" Counts");
- Serial.println(P1.readAnalog(1, 2));
-
- delay(100);
- }
lines 19-26 are commented out to avoid any issues with my remapping the 10 bit signal to the 0-20 mA range and just check if the module is reading anything.
TIA
Do you have 24V wired to the terminal block of the module?
Do you have a P1000 Power supply or external 24V connected to the P1AM-100?