Why do negative values on my iR-AI04-TR seem to count down from 65,535 in Codesys?

Why do negative values on my iR-AI04-TR seem to count down from 65,535 in Codesys?
none 0.0 0

Hello All, I am running into an issue which I seem to be overlooking something simple I believe. I have the IR-AI04-TR with T type thermocouples connected. The thermocouple itself has a temperature range of -325 to 700 degrees, which I have set in the scaling of the card via EasyRemote IO. When using in real life, this sensor measures ambient temperature (70 degrees) then is subjected to a liquid nitrogen bath (-191 degrees).

In CodeSys, everything seems to be working when the temperature value is greater than 0 degrees. Once the sensor goes into the negative values, it rolls around to 65525 and starts coming down. I would have anticipated that because of the scaling in the EasyRemote IO that it would have gone into the negative values.

Is there a different range or setting I should be using?
Using CodeSys 3.5.16.4

Hi @jonmarc91,

I believe that this issue is related to the data type used to display the input value within Codesys. If you are using either “WORD” or “UINT” the supported range is 0 - 65535. To display negative numbers you will need to display this variable as an “INT”:

To convert a UINT to an INT, please use the TO_INT function block as in this example:

Those “Scale Range” parameters (below) are not applicable if your sensor is a thermocouple or RTD.

1 Like

@TimWusa If the scale range parameters are not applicable for thermocouple inputs, is there a default range that is card uses for thermocouples then? Low Limit and High Limits to program a scale against per say.

Would I need to change these values back to the default or can I leave them as is?

There is a temperature range when you select one of the thermocouple type sensors from the “Input Mode”.
If you select “T” from the “Input Mode”, there is a temperature range which is not configurable by users.


I think that selecting the “User Defined” from the the “Input Mode” could be compatible with your T temperature sensor’s full range, if you need a wider temperature range. The information about “User Defined” is documented in the iR-AI04-TR User Manual. See chapter 10 “Downloading User-Defined Temperature Table to a Module”.

Regarding your issue, please look at the answer given by @Brendon.S. To display negative numbers you will need to display this variable as an “INT” within a POU, because in the Modbus mapping menu those four temperature inputs are mapped to an array of “WORD”.

Thank you @TimWusa.

I will look at those settings and confirm. I am trying to regain access to the machine via EasyAccess 2.0 to try the settings by @Brendon.S described. That is what made me wonder what I should expect to see after changing the type from Word to INT, if there was an additional scaling I would need to do or if the values for both Ambient, Low Range, and anything in between would automatically fall inline.

@jonmarc91, is the temperature range that you described in Celsius or Fahrenheit?

Good morning Brendon,
Your original post was the solution needed. I was able to get access to the machine.
The temperatures mentioned were in Fahrenheit.

Guess one final question, with the setup on the EasyRemote IO and the scaling not applying to the temperature range. Does the setting of Celsius or Fahrenheit apply to thermocouple inputs?

The setting of Celsius or Fahrenheit (called “Unit of Temperature”) applies to thermocouple inputs.

Thank you!