I have a school project that I will be comparing the values from the HC-SR04 on an Arduino mega to an HC-SR04 on an uno. If the two values, for example, are both 15 cm, then I need the uno to send a signal to the PLC (high or low). I purchased the RS232 shield from spark fun (RS232 Shield V2 - DEV-13029 - SparkFun Electronics) and I was unsure if I needed to download a MODBUS library so that the UNO and PLC can communicate? I have a data sheet on how to wire it from a previous post. I am just unsure about the sketch that is required in order do make the UNO and PLC communicate.
Even though this is an old post, I would like to answer anyway in case it may be helpful to others. I would like to see more discussion on PLC communication.
Depending upon which model Omron PLC you have, the MODBUS protocol may or may not be available. Also from the Omron side, this may get somewhat complicated. May I suggest that you use Omron's Host Link protocol. This is a simple command / response protocol that will be available on pretty much every Omron PLC made withing the last 30 years.
You would not need full driver support from the Uno side but just a serial few commands to read / write bits or registers. From the Omron side, the RS232 ports are set to speak Host Link by default. Default settings would be 9600, 7, E, 2.
If you are still on the forum, I would like to hear of your progress.
S. Thomas