
HawkCodes (Customer) asked a question.
I am programming a P1AM-100 module with a P1AM-ETH and need help addressing 8 type-k Thermocouples.
I am programming a P1AM-100 module with a P1AM-ETH, two P1-04THMs, and a P1-08TA modules and I need help addressing 8 type-k thermocouples to send from the Arduino IDE through Modbus TCP in order to show on a EA9-T10WCL HMI. What is the correct way to send these thermocouple temperatures in Fahrenheit to the HMI continuously?
Take a look at a couple of our example programs that should get you going:
P1-04THM:
https://github.com/facts-engineering/P1AM/tree/master/examples/Basic/ReadTemperature
https://facts-engineering.github.io/modules/P1-04THM/P1-04THM.html
Modbus with C-More:
https://github.com/AutomationDirect/P1AM-Examples/tree/master/P1AM-100_ModbusTCP_Server_HMI
On the c-more panel, you can create a Floating PT 32 tag in the tag database and assign it to a modbus input or holding register. You can use the numeric display object to display the reading on the c-more like in the example referenced above.
Creating a Tag: Database --> Tag Name Database --> Add
Note: The tag will have to be assigned to a device (p1am-100) in the device name column for the modbus address option to be available.
On the P1AM-100 you can try typecasting the temp reading and write that to the modbus register:
uint16_t whole = (uint16_t)temperature_f;
uint16_t decimal = 100 * (temperature_f - (uint16_t) temperature_f);
Hopefully that should get you going in the right direction.
The HMI is displaying that there is a PLC-001 timeout error and I followed the examples from above. I know it is not the cables because I have tested different ones and I get the same error. The serial monitor reads the temperatures correctly. So I believe the communication error is in the Arduino code or in the HMI set up. Is there a way to determine why the two will not communicate correctly?
If you don't mind could you share your code?
Here is the code I've been using. There are some libraries that are not used but will be implemented later once the communication error has been solved. I have also ran into the problem of not being able to read the 2nd P1-04THM module's temperatures in the serial monitor.
Oven_Code_V3
I solved reading the 2nd P1-04THM module's temperatures in the serial monitor issue with this code but still have the issue of HMI timing out.
Oven_Code_V3
Here is the C-More for the program as well.
OVEN Panel
Appreciate it. The Oven_Code_V3 on line 82 you're using a delay of 5 seconds. That's probably the issue that is interrupting communications. Try removing that and see if it works.
When doing modbus with the c-more panels you'll want to avoid adding delays in your code so that the connection is always handled as fast as possible.
Edit: You can use the method in the example BlinkWithoutDelay if you want to delay some piece of code or other use.
Taking the delay out of the code did not help the timeout error. Am I sending the values through the wrong way? and referencing them the wrong way in C-more? I am using a numeric value in order to display the temperatures.
If you haven't already, I would check the ip settings and that you can ping both the p1am-100 and the c-more panel.