From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling an Omron E5CN-H with Labview

Hello all,

I use an Omron E5CN-H as a temperature controller, which has its own software, written in some low-level programming language, which works but doesn't integrate well with Labview, so I cannot easily keep track of all the measurements from other apparatus in an efficient maneer. I would like to control it with Labview, too.

I have found the thread https://forums.ni.com/t5/LabVIEW/Omron-E5CN-Drivers-Help/td-p/2136658?profile.language=fr&lang=en, in which nguyenxuanthai provides some Labview codes to take control of the apparatus. I have correctly input some parameters (such as the baud rate, the parity, the data bits, etc. which I had identified from the source code of the working software that can already control the apparatus), but unfortunately the code gets stuck in an infinite loop. An error is returned after a few seconds, as you can see in the attached screenshot.

 

bug_labview.PNG

I tried to input different number of bytes read, from 2 to 500, and the code always returns this error no matter what. It's as if the apparatus is unable to read the specified number of bytes, and times out, as far as I understand. The error is 1073807339.

Do you have any idea on how I could proceed to succeed in taking control over this apparatus via LabView?

Thanks a lot! 

 

0 Kudos
Message 1 of 8
(1,550 Views)

Do you have the manual for this device?

 

You set the VISA Serial Configure to not have the termination character enabled.  It seems like that should probably be True.

 

Do you know if it uses a termination character, and is it a linefeed character which is the default setting since you don't have anything wired to that input?

0 Kudos
Message 2 of 8
(1,540 Views)

Yes, I have the manual. It is rather thick, and I do not find any information about how to "talk" to the device from a connected computer.

 

Regarding the VISA setting, I didn't change the default value, but changing it to true does not change the error.

 

I do not know about the termination character and whether it is a line feed. I guess I could probably figure this out by reading the source code of the software.

 

Edit: Here is an example of a snippet of code in the software that controls the apparatus :

if (TextBoxCommunication.TextLength > 82)
{
TempOmron = TextBoxCommunication.Text;
TextBoxCommunication.Text = "";
Console.WriteLine(TempOmron);

// 01 0000 0101 0000 00D8 7000 0116 0000 0000 0000 0000 0000 0000 0001 0000 0000 0001 0001 0001 0000 0000 =21,6°C

 

Can this guide me in some way?

0 Kudos
Message 3 of 8
(1,533 Views)

Hi Bug,

 


@unspotted_bug wrote:

Yes, I have the manual. It is rather thick, and I do not find any information about how to "talk" to the device from a connected computer.


There has to be a chapter in this manual about the communication scheme. Or there is a seperate manual especially for that topic…

The conclusion is: Read the fine manual!

 


@unspotted_bug wrote:

if (TextBoxCommunication.TextLength > 82)
{
TempOmron = TextBoxCommunication.Text;
TextBoxCommunication.Text = "";
Console.WriteLine(TempOmron);

// 01 0000 0101 0000 00D8 7000 0116 0000 0000 0000 0000 0000 0000 0001 0000 0000 0001 0001 0001 0000 0000 =21,6°C

 

Can this guide me in some way?


Just a very little bit I guess…

I don't know why there is a limit of 82 chars in some TextBox text (again: read the manual!), but that comment seems to indicate the "binary" nature/format of the message. That 21.6°C corresponds to the 00D8 word, with a scaling/resolution of 0.1°C…

But again: you need to read the manual to learn about the meaning of all those bytes in this message!

 

Edit: Does that software require you to input that whole message using hexadecimal values? The example contains 20 words (40 bytes) plus an additional byte in front: in total there are 41 bytes, consisting of 82 chars…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 8
(1,509 Views)

Yes, read the manual!

 

https://assets.omron.eu/downloads/manual/en/v3/h157_e5_n-h_users_manual_en.pdfhttps://assets.omron.e...

 

I'd say:

1) You need the E53... optional unit

2) You need to select the desired protocol in the configuration of that device (I would go for Modbus).

 

Regards, Jens

Kudos are welcome...
0 Kudos
Message 5 of 8
(1,496 Views)

Ok, I have found a (very complex to me) communication manual: https://assets.omron.eu/downloads/manual/en/v2/h159_e5_n-h_communications_manual_en.pdf. The manual I have doesn't have anything of the sort, it is all about controlling it manually, or how to connect it via usb to a computer.

 

I do not use the Software provided, because it does not integrate with Labview, but as far as I remember, it is extremely basic (cannot use fully the apparatus) and the temperature is specified in decimals, not hexadecimals.

 

Regarding the E53 unit, what is it, exactly? Is it a hardware thing?

And as far as I understand, the Labview code I linked to already uses Modbus. Nguyen said "I can connect and run E5CN tempt. controller to Labview through Modbus." and he shared his files, so I assume it should work and that he is using Modbus.

 

 

I am still going through the code. Now I see the line "buf[26] = 0x03; // ETX", which, if I understand correctly, means that there is the end of line byte that needs to be sent, when setting a temperature. I see that there is also "PortCom.Write(buf, 0, 28);", where I think the 28 means that the buffer contains 28 words (so 56 bytes I suppose). I can just copy and paste the first bytes, as they are not related to the temperature itself. Strangely though, the very last bytes are not the end of line ones. They are computed as follow:

 

int bcc = 0;
for (int i = 1; i < 27; i++)
{
bcc = bcc ^ (int)buf[i];
}
buf[27] = (byte)bcc; // BBC

0 Kudos
Message 6 of 8
(1,453 Views)

That 28 probably means bytes, not words.  Because buf[26] is only a byte, not a 2-byte word.

 

The last byte "BCC" is a checksum.  The ^ character means you are XORing the new byte with the current value of the checksum, which starts out as 0 before you look at the first byte.  See if the very last (28th) byte, is always the same value us as a Null (hex 0).

 

 

 

 

 

 

0 Kudos
Message 7 of 8
(1,446 Views)

@unspotted_bug wrote:

Ok, I have found a (very complex to me) communication manual: https://assets.omron.eu/downloads/manual/en/v2/h159_e5_n-h_communications_manual_en.pdf. The manual I have doesn't have anything of the sort, it is all about controlling it manually, or how to connect it via usb to a computer.


That's very common. The names may vary a little but most devices do have something like an Operating Manual, which shows how to get it connected up (plug in power mains, switch device on, set measurement mode on front panel, be happy), and a Programmer Manual, or Communication Manual or whatever it is called, which describes in more detail how to programmatically communicate with the device. This manual looks usually very complicated, seems overly detailed but generally still misses some details that you have to find out by trial and error, since most device developers only know their specific system and can't imagine that there are specific things that can vary greatly between different hardware architectures.

Rolf Kalbermatter
My Blog
0 Kudos
Message 8 of 8
(1,427 Views)