8/7/2019 10:21 PM | |
Joined: 7/7/2010 Last visit: 3/21/2025 Posts: 15745 Rating:
|
Would you please capture the Done / Error outputs and count how many times each one becomes true? A couple of simple ADD blocks that adds 1 to a tag triggered from a NO MB_Master_DB-5_Done and another for MB_Master_DB-5_Error. Then you can see if you are getting done or error. If you are getting done bits, you are getting the data. If you are getting the error bit, you want to save the STATUS output when the error bit is true and look up the error using F1-Help for the Modbus_Master block The F1-help for the block is very extensive. That said, it sometimes helps to know Siemens created a block where they try making the Modbus RTU requests slightly easier to understand - at least compared to older MB request blocks that use the "implied" leading 4 for reading registers. Mode 0 is correct. Have you configured the instance DB parameters (you have to click on the blue "Parameters" link in the F1-Help for them to appear)? You have to "connect" - using to the MB_DB parameter of the instance DB - the Modbus_Comm_Load call to this Modbus_Master block. What does your Modbus_Comm_Load call look like? Or, did you not use it? From F1-Help:
After reviewing the above copied rules, I think you will find your solution. I will not assume you have the Modbus_Comm_Load block correctly configured and the instance DB (DB157) properly referencing the MB_DB. Your posted image tells me you wish to request a read of registers 450520, 450521, 450522, 450523, and stuff that into "Modbus Registers"."500kW Data Read_Outgoing" which looks like a BOOL. What I expected to see for DATA_PTR is an array of UINT or INT or WORD from 0..3 (length of 4). Let's say DB "Modbus_Registers" has this starting at offset 180: 500kW_Data_Read_Register : Array[0..3] of WORD (or UINT or INT) Then at DATA_PTR, this is all you need "Modbus_Registers".500kW_Data_Read_Register Then you can access registers like this:
And if you want to read individual bits:
You can also insert UDTs in place of the arrays to transfer the data into the right location and give it a tag name that makes sense, like bit 0 = Running, bit 1 = Faulted, bit 2 = Ready, bit 3 = InvalidConfiguration, and so on. Lastly, if you are able, I would recommend trying at least 57600 baud rate. If you are baud rate limited because of an existing Modbus RS485 network, that's fine. Otherwise, 57600 should be possible unless you are not using proper shielded cable with the correct impedance for Modbus communications. This guide can help: http://www.modbus.org/docs/Modbus_over_serial_line_V1.pdf Most documentation states 9600 / 19200 are common baud rates. If I cannot get 57600, I know I have a bad cable termination, poor cable routing, or the exact same brand and part # cable was not used throughout the Modbus network which messes with the cable to cable impedance matching. If you are happy with 9600 and it works for you, that's fine. I am simply stating you may want to consider bumping it up until it starts to fail, then back it off at least one speed setting.
AttachmentModbus_over_serial_line_V1.pdf (230 Downloads) |
Last edited by: Jen_Moderator at: 08/08/2019 07:01:19Added pdf file as an attachment. science guy |
|
8/8/2019 3:15 PM | |
Joined: 6/30/2016 Last visit: 2/22/2024 Posts: 24 Rating:
|
Hi Huggy, I have already configured 'Modbus_CommLoad' Instruction see attached PDF file, and its working fine for other 3rd Party Modbus Slave devices. Also i am using 'Done' & 'Error' bit from the 'MB_Master' block. Currently i have used 7-slave devices, out of that 1-Slave devices is not able to communicate (where the address register starts from 5000+ series) with Baudrate-9600. (See attached PDF for execution of 'MB_Master' block sequentially in the program) The tag assigned for 'DATA_PTR' field in 'MB_Master' block is an 'Array of UDint'. It will be difficult to use 57600-Baud rate because all other slave devices are in 9600-Baudrate. As you informed i have added a counting tag for Done & Error Bits of the MB_Master block where i will be executing for reading the 5000+ series Modbus registers, only Error bit is incrementing not even a single time Done tag is incremented. Regards, Santosh AttachmentModbus Blocks.pdf (244 Downloads) |
Santosh |
|
8/9/2019 12:59 PM | |
Joined: 6/30/2016 Last visit: 2/22/2024 Posts: 24 Rating:
|
Hi All, Sorry, for not mentioning the Counter part in my last attachment. Here is the counter logic which i have added for the 'MB_Master' Block Done & Error Bits with Status captured. In the status when the Error bit is triggered, the block is giving the status as mentioned below. 16#81E2 - Frame aborted: Character frame error Once again i have checked with Modbus Software to confirm the Communication parameters and wiring are correct to the slave devices, when i checked i can able to read the actual register parameters without any issue. Only thing i am doing in the Modbus Software is, i am swaping the words to get to see the actual values. (Data type of Modbus Registers is U32 for the Slave Device Id-8) Communication Parameter Used are: Baudrate: 9600 ; Parity: None ; Stop Bits: 1 ; Data Bits: 8 So, can anyone help me how to proceed further please. Regards, AttachmentModbus Block Counter.pdf (236 Downloads) |
Last edited by: Santosh1989 at: 08/09/2019 13:00:28Changed the Slave ID which was mentioned wrong. Santosh |
|
8/9/2019 4:48 PM | |
Posts: 3093 Rating:
|
Hello, Regards, |
Follow us on