Enron Modbus Client on EPIC

Reaching out for some help.
We have a project which requires us to obtain data from some Emerson Flow Computers. Unfortunately, these use Enron Modbus as their protocol.
I have looked for ways of getting this data intto Codesys running on EPIC PR1, but there is no Codesys driver!
No driver in Ignition nor Node-Red that I can find either.

Anyone got an idea on how to achieve this using either Ethernet or RS485?

I had never heard of it, but a quick Google showed this:

I think you can just use the Node-RED node and fix it on the back end.
@philip would hopefully have some thoughts on this.

Yes, that’s the beast!
I have used all sorts of Node-Red Modbus flows to achieve this, but have hit a brick wall with them all.
The nearest I got was using node-red-contrib-modbustcp, but it seems to use its 2nd byte as a message counter.
As an example, if I want to read a single float (32-bit in a single register) at register 7003, slave ID 100, using FC3 the transmit should be:
00 00 00 00 00 06 64 03 1B 5B 00 01
but this flow transmits:
00 01 00 00 00 06 64 03 1B 5B 00 01,
Next time:
00 02 00 00 00 06 64 03 1B 5B 00 01,
So close, yet so far!

If you are desperate, I have written a partial Modbus RTU serial 485 in CodeSys. I believe someone else’s fully tested and more functional solution would be a better choice. But if your stuck let me know. I could send you the code.
Using the SysComOpen, SysComSetSettings, SysComRead, SysComWrite functions.
Read only - coils, discrete inputs, holding regs, input regs. Supporting types bool, int16, uint16, int32, float.
It is written pretty generically.

1 Like

Hi Dave,
I welcome your offer. It will be a starting point, which I don’t really have at the moment.
Thank you for your reply.

If you can get it going in Codesys, that would be good since that is where you want the data. If you want to try it in Node-Red, here is some test logic I have that makes an OptoMMP request for inspiration. (I don’t parse the response in this sample though). The same thing could be done to make a modbus request (it is a fairly simple protocol).

Build MMP packet node (you would need to modify to represent the modbus protocol)

//OptoMMP packet
mmp = {
    dest : 0,  //16b always 0
    tl : 0,  //6b optional
    rt : 0,  //2b always 0
    tcode : 4, //4bits
    pri : 0, //4b always 0
    source : 0,  //16b optional
    offset : 0xFFFFF1001900, //48b address
    length : 0, //16b only on blocks, specifies byte length of data section
    extcode : 0, //16b always 0, only on blocks
    data : 0 //varies, fixed 32b on quadlet response

mmp.tcode = 4;
mmp.offset = 0xFFFFF1001900;

msg.mmp = mmp;

return msg;

Take the data and turn it into a byte array to send by using the javascript Buffer library:

const buf = Buffer.alloc(12);
pos = 0;

pos = buf.writeUIntBE(msg.mmp.dest, pos, 2);
pos = buf.writeUIntBE(msg.mmp.tl << 2 | msg.mmp.rt, pos, 1);
pos = buf.writeUIntBE(msg.mmp.tcode << 4 | msg.mmp.pri, pos, 1);
pos = buf.writeUIntBE(msg.mmp.dest, pos, 2);
pos = buf.writeUIntBE(msg.mmp.offset, pos, 6);

msg.payload = buf;

return msg;

Since it is poll response, I just feed to the TCP node. The response will then need parsed to get the data you need. The Buffer has read classes for this as well.