danielo
Hi.

I am using an Orange Pi PC as a Modbus TCP server/client parser (blank Linux, no need for physical I/O). I have a client that can only send two registries at the same time with Modbus function 16, and a server that accepts commands coded with 4 (holding analog regs). I would like to use my OpenPLC to receive an order and translate it to a 4W write to my server. commands 1 to 6 and 100 (more later). It works on simulation, but not on the PLC. It is showing a strange behavior and not writing the value to its corresponding address.

Any guess why? ssslavedev.png  ssmonitoring.png
Quote 0 0
danielo
It also gives me an error when I upload the program.

Optimizing ST program...
Generating C files...
./st_files/113230.st:19-6..19-30: error: Bit size of data type is incompatible with bit size of location.
./st_files/113230.st:25-6..25-34: error: Bit size of data type is incompatible with bit size of location.
./st_files/113230.st:26-6..26-34: error: Bit size of data type is incompatible with bit size of location.
./st_files/113230.st:27-6..27-34: error: Bit size of data type is incompatible with bit size of location.
./st_files/113230.st:28-6..28-34: error: Bit size of data type is incompatible with bit size of location.
./st_files/113230.st:29-6..29-36: error: Bit size of data type is incompatible with bit size of location.
./st_files/113230.st:30-6..30-36: error: Bit size of data type is incompatible with bit size of location.
./st_files/113230.st:31-6..31-36: error: Bit size of data type is incompatible with bit size of location.
./st_files/113230.st:32-6..32-36: error: Bit size of data type is incompatible with bit size of location.
9 error(s) found. Bailing out!
Compilation finished with errors!
Error generating C files
Quote 0 0
thiagoralves
I don't think it was very clear to me what exactly you're trying to accomplish, but in any case, %QW and %IW locations are WORD sized (INT, UINT, WORD, etc), not DOUBLE-WORD sized (DINT, DWORD, etc). You need to change your variables size to WORD or INT for it to compile correctly.
Quote 0 0
danielo
Thank You! It works now. The first 3 Festo CMMO controllers work fine, but not the rest, I don't know why. The CMMO controllers work with 4 registers' input/output in its simplest mode. I want to work with 1-word order from another Modbus client. I don't read anything from analog inputs from devices 4 to 11. 
Analog output 0 is the order code, the first byte of reg 1 is the position of a commissioned table to get the data from and 2-3 = 0.
Analog input 0 is the response and I don't need the rest but I have to read it.

ss.png 
Quote 0 0