Logix 5000 + Phoenix Thermocouple Module

cking2729

Member
Join Date
Jul 2014
Location
texas
Posts
9
Hello!

I am running a Logix L63 processor with some Phoenix Inline I/O connected over EtherNet/IP. One of the Phoenix modules is a 2 channel thermocouple module, IB IL TEMP 2 UTH.
I noticed I was getting readings from the module that were way off.
One thing I observed...when the INT input value reads 454 in decimal (aka 45.4º celsius) the binary is like so:
input.0 = 1
input.1 = 1
input.2 = 1
input.3 = 0
input.4 = 0
input.5 = 0
input.6 = 1
input.7 = 1
input.8 = 0
input.9 = 0
input.10 = 0
input.11 = 0
input.12 = 0
input.13 = 0
input.14 = 0
input.15 = 0

This is way off from the actual measured value from an infrared gun, however. Whenever I flip around the MSB and LSB, however, resulting in a binary of 011000111, I get a decimal value of 199 (or 19.9º celsius aka the temperature value I am actually looking for!)

So due to this flip, I have searched up and down for ways to swap bits, bytes, change endian in my code to make this work! I haven't had any luck and I am in a bind for a solution! It doesn't appear the module itself supports any swap around, so now I am wondering if someone has a genius (or at least somewhat brilliant) way to pull this flip off in Logix PLC?! Any help or code would be much appreciated!🍻

P.S. here's what I tried before resorting to looking at bit-level PLC stuff:
Everything with the module was left at default, which means K-type thermocouple, 0.1 celsius resolution. Things seem fine, such as when I apply heat to the thermocouple the appropriate INT input value in the PLC increases; when cooling it drops. But a red flag is that at room temperature, the thermocouple reads around 45º celsius. That's obviously crazy high, and my tested room temperature is between 19-21º celsius. I tried a new thermocouple, different channel, different phoenix module, different ethernet adapter, performed setup over again.....no change in results.
 
You very well may have to byte swap, but I would read the module's manual for clarification of how the data map works. I assume you have a generic Ethernet device configured to read it?

Look into the BTD instruction to shift to the high byte, then ADD/MOV/COP/MVM to the low bytes (depending how the data is being mapped to the controller you might have a more "obvious" method).

This is all coming from a hazy memory...
 
Most Ethernet/IP devices I've used have supported byte/word swapping before it sends the data to the PLC, to avoid exactly this situation. But, if you're sure the Phoenix doesn't have an option for it, then the SWPB instruction mentioned above is what you need.
 
First off, kudo's on noticing the Endian problem.

As for your line of code, add an empty rung, double-click to the left of the empty rung, and paste this: "SWPB Wrong_Endian HIGH/LOW Correct_Endian" (without the quotes).

Be sure to create your "Wrong_Endian" and "Correct_Endian" as INTs (not DINTs).


Edit:

Wait a minute...

I pasted the two numbers side by side in NP++ and came up with this:

454 = 0b111000110
199 = 0b11000111

After "normalizing" 199 to nine bits to match what 454 needs, I got this:

454 = 0b111000110
199 = 0b011000111

So it looks like you need the order reversed...
 
Last edited:

Similar Topics

Does anyone know how to set the background colors of instuction blocks (TON, MOV, etc)?
Replies
1
Views
83
Hello all, I have a question in regards to RSlogix 5000. I am having issues with the program force closing when I try to make online edits. We...
Replies
0
Views
95
Greetings ... someone sent me a request for some student handsouts that I developed ... turns out that I had this hosted on my business website...
Replies
0
Views
109
This may be something obvious that I could learn if I sat down to understand the topic in detail with tutorials and manuals. But sometimes it's...
Replies
0
Views
117
Thank you for any and all responses/help. I have an RSLogix 5000 v20 and a Cognex In-Sight v5.9 spreadsheet (8502P). I can not figure out how to...
Replies
0
Views
101
Back
Top Bottom