Go Down

Topic: ModBus RTU between Omron CP1E (CP1W-CIF11) and an Arduino using MAX485 RS485 (Read 145 times) previous topic - next topic

Jose_Silva_BR

Hello everyone!

Briefly introduction, I would like to communicate and test the following hardwares:

1- Omron CP1E (using an Option Port CP1W-CIF11) ; and

2- Arduino Nano using MAX485 RS485 transceiver.

The CP1E will operate in "Modbus-RTU simple master" as illustrated in image 01. The arduino will be in slave mode address 1 and the library used is "SimpleModbus NG" ( https://github.com/angeloc/simplemodbusng/tree/master/SimpleModbusSlave ).

Taking the sample in official manual ( https://industrial.omron.eu/en/services-support/technical-tools/downloads#cp1e ) , pages 248-253 in the "CP1E CPU Unit Software User's Manual" (Image 04) describes a sample communication to an "Inverter Slave".

I want to use the Arduino Slave as the Inverter Slave just to be sure that all previous steps are correct.

Therefore, I would like to know:

1- As illustrated in Image 02, Am I missing any resistors?

2- Should I connect the GND to the FG?

3- Do I need to remove the Arduino from PC's USB after programming? I'm asking it, because I'm using the HardwareSerial.


(Specific questions)
4- In this scenario, the DIP switch setup should be as illustrated in image 03? Only DIP4 is OFF.

5- Can I test it just forcing A641.00 and checking the DM Area Data, as shown in Image 05


The code used in it is the following:

Code: [Select]

// Wiring: Arduino and MAX485
// RX0 - RO
// TX1 - DI
// D2  - DE/RE

#include "SimpleModbusSlave.h"

enum {
REGISTER_0,
REGISTER_1,
REGISTER_2,
REGISTER_3,
REGISTER_4,
REGISTER_5,
REGISTER_6,
REGISTER_7,
REGISTER_8,
TOTAL_REGS_SIZE
};

unsigned int holdingRegs[TOTAL_REGS_SIZE] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };

void setup() {
modbus_configure(&Serial, 9600, SERIAL_8N1, 1, 2, TOTAL_REGS_SIZE, holdingRegs);
}

void loop() {
modbus_update();
}



Image 01


Image 02


Image 03


Image 04


Image 05




Any answer can be helpful. Thank you for your time!

 

Regards,

Jose.

pylon

Quote
1- As illustrated in Image 02, Am I missing any resistors?
Not resistors but the wiring is wrong. You're using the hardware serial interface but wired for a software emulation (which I seriously recommend against using it). So change your wiring to match the software.:

RO -> RX0
DI -> TX1
RE/DE -> D2

Quote
2- Should I connect the GND to the FG?
What's an FG? If it's the Omron, the answer is no. RS-485 signals are transferred differentially, so GND is not necessary and will make things only more complicated.

Quote
3- Do I need to remove the Arduino from PC's USB after programming? I'm asking it, because I'm using the HardwareSerial.
No, you don't need to but you also cannot use the PC connection (p.e. for debugging the software).

Quote
4- In this scenario, the DIP switch setup should be as illustrated in image 03? Only DIP4 is OFF.
With the information I have I'd guess this is correct.

Quote
5- Can I test it just forcing A641.00 and checking the DM Area Data, as shown in Image 05
I hope you know the Omron well enough to answer that question. Otherwise ask the vendor. The Arduino should answer if the Omron is asking for the values.

Go Up