Jump to content

Recommended Posts

Posted
Hi everyone! CPU: Q03UDE. GX Works 2 1.91V. The program should read bits and integers from a slave. But when certain bit change state a write command (write single bit or write single integer) should be issued to the slave. The adress of the register to be written in different depending on the bit that is activated. So far I have tried to test the QJMB91ModbusSerial_V120 example. Only Automatic communication mode example is working, the other example using dedicated instruction just doesn't work. The plan is to use Automatic communication mode for sequential reading the Slave and using dedicated instruction for writing a bit or an register when necessary, but I didn't succeed using dedicated instruction so far. Any suggestions? Thank you.

Posted
You cannot combine the two. Either use automatic communication or use dedicated instructions. What is the problem with writing the actual value all the time to the slave? Alternatively you should use all dedicated instructions, and simply write a small sequence to handle both reading and writing...
Posted
Both communication types can be used: QJ71MB91 User's Manual 080578 - chapter 9.2.3. Tested and working with MBREQ function. Two observations: 1. Function QJMB91ModbusSerialMasterAutoCh1, doesn't work properly in my sistem: the write command is send but the data that was sent was not updated. - write value of D0 to reg1 in slave - change the value of D0 - only after 2-4 cycles the updated value of D0 is sent. 2. The QJMB91ModbusSerialMaster is working fine. But if an on-line change of the program were the function is located, is made, the function stops working! No reset of power off won't do the job. To make it start again, a "Rebuild All" and a write to controller must be executed. Any idea why? I have seen that MBR is used in the function.
Posted
You have taken into account that you must ensure that the channel is ready before executing any MBREQ instructions? You have a sequence program ensuring that the channel is ready and free before executing dedicated instructions?
Posted
Yes, only when the conditions in figure 9.24 are met. The other channel should be programmed in slave mode. I have tested the with Modbus Device Assignment Parameter and it works well. But I need a part of registers to have read/write access or only read access depending of the value of a BOOL register. Or at least to have Read/Write permission or no access to that part of the registers. Thank you.
Posted
For read/write assignement you need to use HoldingRegisters linked to an area in your PLC. InputRegisters are for reading only, hence your master will not be able to write into these areas.
Posted
The registers I want to enable/disable the write rights are holding registers. I want that the write acces to be enable/disable depending on the value of bool registry. Thank you.
Posted
Not sure what you're asking here; do you want to enable/disable "groups" of holding registers depending on bool's? E.g.: If M0=1 -> enable D0 If M1=1 -> enable D1 If M2=1 -> enable D2-D100
Posted (edited)
Yes, I want to enable/disable groups of holding registers: If M0=1 -> enable group 1 holding register D0-D100 If M0=0 -> disable group 1 Tried with QJMB91ModbusSerial_V120 Slave, but it is working all the time. I will try the example from the manual "9.2.2 MODBUS® device assignment parameters- Figure 9.18 MODBUS device assignment parameter setting program example". Another question: first channel is programmed as master with automatic communication. If I try to read more than 45 holding registers from the slave the module returns one of the errors: 7411, 7378 and the data is not updated. I have set a larger value (100) for the Response monitoring timer, but the problem still persists. I have tried reading data from PC and it works fine. I believe that the Slave doesn't send the entire packet in a single sequence, and the PLC does not wait the other sequences. Edited by WKla
Posted
I've never tried to enable/disable device assignement groups, but do you need this dynamically or is it a "Initialization setup procedure"? The errors you have provided indicates CRC/LRC error and Timeout error. Most likely: 1. You're outside the range of the slave device (how many registers does it support reading)? 2. The slave hasn't implemented correct error response procedure (if outside of range it should respond with an exception code) With the CRC/LRC error I would guess that the slave simply sends a response, and the Q tries to read the CRC at the given position but this does not correspond with the correct code. The timeout error is pretty much since the Q never receives a correct answer (allthough it does receive an answer)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...