Hi, what type of Omron PLC are you using?
Omron SYSMAC CQM1 CPU41-V1 and DM200 as memory address.
Are you using FINS protocol message or using the PLC COM function to send a message from the PLC?
Also, the com port on the PLC will need to be set appropriately.
Ps, the FINS protocol is fairly simple and we'll documented (search it)
I'am using PLC COM to send a message and serial port to connect PLC to laptop.
As you are not using FINS (host link protocol) you should verify PLC com port is set for RS232C mode?
Is your COM port set to match baud rate and format setting in the PLC?
Can you post screen shot of ladder and explaining the parameters used?
E.g. if you use the TXD function, what is in your control word?
Do you check the AR flags in the PLC to ensure the port is ready for sending?
No i have set PLC COM port in HOST link mode
i have set the same format setting used in PLC (9600 , 1,7,1,E)
How to check If port is ready for sending ?
I've seen you've tried the modbus read node, but in the specs of the PLC you can't find anything about modbus. Maybe you need a gateway..
ok i will try it. Thanks
no i don't think i need a gateway. i'am using serial port to communicate nodered with PLC.
Ok, that is the communication path, but the protocol?
protocol used is RTU
As you are using host link protocol, you must 1st form a host link protocol packet and transmit it to the PLC. If it is formed correctly, then the PLC will reply with a host link protocol reply which you would need to break down and verify before extracting the value.
It may be beyond your capabilities or requirements to generate a flow that performs host link protocol, so perhaps you should...
- Change plc to RS232C mode
- Add ladder to call TXD function periodically (e.g. every second)
- Use serial port node to read and parse the comm string received.
FYI search for OMRON HOST LINK PROTOCOL. It's a fairly simple protocol and well documented (just search the internet). Node-red is perfectly capable of performing the work of becoming the driver.
Testing...
As a test, try sending "@00RD00000010" to the COM port in NR.
Terminate this with a * and a CR.
You should get some response with the contents of DM0 that you can parse in NR.
FYI Host link protocol...
http://www.tri-plc.com/HostlinkE10.pdf
Additional info (possibility of converting someone else's VB code)...
https://accautomation.ca/how-to-implement-the-omron-plc-host-link-protocol/
Like i said, its a fairly simple protocol but may be more work than you planned.
thanks alot. i will make test as soon as possible and seach more about hostlink protocol and give feedbacks.
Do i need to use modbus to read and write to PLC or just serial port node ?
OMRON doesn't do MODBUS (so yes, just serial port nodes)
Host link protocol is a completely different protocol to MODBUS protocol.
However, I have seen some PLC logic (somewhere on OMRON site or Mr PLC site - I forget) that runs inside the PLC and simulates MODBUS.
So when I say OMRON doesn't do MODBUS I mean the protocol is not built in but can be approximated through PLC logic.
In theory, if you find this code and it works on the CQM1 you can use the MODBUS nodes.
Good luck.
Ps, don't forget to feedback your progress for future users.
This could get you somewhere: https://github.com/Jozo132/node-omron-read
I succefully connected with a CS1 Series plc and got an array of data. I'm still in the process of making sense of it...
Unfortunately CQM PLCs don't have ethernet and not certain you can add ethernet - so no FINS over Ethernet I'm afraid.
On a side note, I downloaded that node some time ago and reworked it to include a write node (and a shared connection node for multiple read / write nodes)
Just never did it in a controlled manner so never did a pull request.
CR is not meant to be letters appended. It's a control character. (see ASCII table).
CR tells the PLC this is the end of the message.
The structure of a host link protocol message is...
MSG + FCS + "*" + Chr(13)
Additionally, I suspect you did not read the links I posted earlier. There is also a check sum to calculate.
see the BASIC example here. It shouldn't take much to create a NR function node that can calculate this checksum (convert the BASIC to JS).
Some pseudo code to illustrate...
MSG = "@00RD00000010"
FCS = CalculateFCS(MSG)
ASCII_TO_SEND = MSG + FCS + "*" + CHR(13)
Supporting info...
As a test, I have calculated the checksum as 57 for that message.
@00RD0000001057*
Try sending that string to the serial port.
Set the folwing settings on the serial port
config...
- Input
- Split input - on the character:
\r
- and deliver:
ascii strings
- Split input - on the character:
- Output
- Add character to output messages:
\r
- Add character to output messages:
NOTE: \r
is equivalent to CR (ASCII 13) it has a value of 0x0d
If the COM port selected is correct and the baud etc match up, when you send @00RD0000001057*
as a payload into the serial in
you should get a response like ...
@00RD00123404D212340000FBE003000000080400000A29*
How you break that response up is up to you but the format can be easily inferred from the official (and many sources available on the internet
For starters - this will be useful...
and this...
this is really frustrating, i have put all the necessary configuration and i always get the same error and get no response from plc
[{"id":"4dd21e5.c37dde","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"70f19eab.272a8","type":"debug","z":"4dd21e5.c37dde","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":668,"y":186,"wires":[*]},{"id":"870cca38.5ac158","type":"serial request","z":"4dd21e5.c37dde","name":"","serial":"e0a56a20.9313b8","x":467,"y":185,"wires":[["70f19eab.272a8"]]},{"id":"919d3249.bbbd9","type":"inject","z":"4dd21e5.c37dde","name":"","topic":"","payload":"@00RD0000001057*","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":271,"y":156,"wires":[["870cca38.5ac158"]]},{"id":"e0a56a20.9313b8","type":"serial-port","z":"","serialport":"COM3","serialbaud":"9600","databits":"7","parity":"even","stopbits":"2","waitfor":"","newline":"\r","bin":"false","out":"char","addchar":"\r","responsetimeout":"1000"}]
for now i really want to get response in NR then i will be thinking of dividing it.