I decided to use a "Click" to do some math that the HMI I used couldn't do. Basically, I used the HMI read three analog values from a remote I/O device over Modbus, then sent the values to a Click for some math. I read the calculated values back to the HMI for display. It should have been straight-forward and I didnt expect any issues, even though it was my first experience with a Click.
Anyway, I used ice water and boiling water to determine what the analog values were at 0 and 100C (16,384 and 49,152).This means that there are 36,768 points in 100C or 367.68 points in a Celcius degree.
Let's say I read an analog value of 24,000. Logic dicated that Temperature = (24,000-16,384) / 367.68 = 20.71C. Along the same logic, 40,000 points would equal 64.22C. However, I was getting values not even close to what I expected and even had negative temperatures displayed. the solution was:
(65,535 - analog value - 16,384) / 367.68
This makes no sense to me. Can anyone offer a suggestion?
Note: The analog values I used above may not be actual.
Anyway, I used ice water and boiling water to determine what the analog values were at 0 and 100C (16,384 and 49,152).This means that there are 36,768 points in 100C or 367.68 points in a Celcius degree.
Let's say I read an analog value of 24,000. Logic dicated that Temperature = (24,000-16,384) / 367.68 = 20.71C. Along the same logic, 40,000 points would equal 64.22C. However, I was getting values not even close to what I expected and even had negative temperatures displayed. the solution was:
(65,535 - analog value - 16,384) / 367.68
This makes no sense to me. Can anyone offer a suggestion?
Note: The analog values I used above may not be actual.