Modicon PAC Forum
A forum for topics related to the scope of Modicon PAC offers and ecosystem along the whole lifecycle: Modicon M580 and 340, EcoStruxure Control Expert, EcoStruxure Process Expert (Unity Pro) and more.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2022-01-17 11:37 AM
Hi All
I am trying to read from input register 3x of skf analyst software using Quantum PLC ( 140 CPU 652 60 & 140 NOE 771 10)
I tried MBP_MSTR but it didn't work.
Any ideas please. Please feel free to suggest other PLCs (m340, m580,etc) as well if quantum doesn't support reading 3x from 3rd party
Ali
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-12-13 12:05 PM
Hi Ali,
Did you get this figured out?
If not, a couple of hints with the Quantum:
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-12-15 05:26 AM
MBP_MSTR can read only 4x registers. To read 3x registers you can use READ_VAR.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-12-19 08:40 PM . Last Modified: 2023-12-19 08:50 PM
Read_Var would be easier but this is not available in Quantum, and Read_Reg which is the quantum function does not read input registers.
you can use the MBP_MSTR function only you have to use mode 15 to send a Modbus Request and set the Modbus function code to read input registers. It is possible, it is just complicated. The help in Control Expert will help. The Modbus Function code you need is 04 to read input registers.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-12-20 07:16 PM
Yes, you’re right. I just helped someone getting the read and write to coils working.
The hardest part is getting the bytes setup in the words properly. It’s easier to view everything in hexadecimal.
I also found that it made more sense to write everything out in decimal, ignoring the bytes, then converting to hexadecimal and adding the extra bytes (using the modbus manual). Then combining everything into the words. I can send examples on Tuesday.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-12-26 08:02 AM
In this example I'm writing to coils (%M):
From the Modbus Application Protocol manual this is the structure of my request (write multiple coils):
Function Code: 1 byte
Starting Address: 2 bytes
Quantity of Outputs: 2 bytes
Byte count: 1 byte (value is N*)
Outputs Value: N* bytes
Also from the manual N* is number of registers divided by 8 and rounded up.
In my application I have 2 registers I'm writing to starting at register 17 so my request is as follows:
Function code: 15
Starting address: 16 (0 based addressing)
Quantity of ouptuts: 2
Byte count: 1 (2÷8=0.25 but rounded up is 1)
Outputs value: 3 (turn both outputs on: 3 is 0000 0011 in 8 bit binary)
Convert to hex to make the bytes easier to read:
Function code: F
Starting address: 10
Quantity of outputs: 2
Byte count: 1
Outputs value: 3
Adding padded 0's to make all of the bytes is use visible:
Function code: 0F
Starting address: 0010
Quantity of outputs: 0002
Byte Count: 01
Outputs value 03
Combining them into a long stream the whole request looks like:
0F001000020103
Breaking up into the WORDS used in Control Expert and adding extra 0's to complete the last word:
0F00 1000 0201 0300
So using the example in control expert for MBP_MSTR operation code 15 the first part of my Data Buffer array should look like:
Buffer[1]: 16#0F00
Buffer[2]: 16#1000
Buffer[3]: 16#0201
Buffer[4]: 16#0300
My Control Array should look like:
Control[1]: 15
Control[2]: 0 (system reserved for error code on response)
Control[3]: 11 (the example had the buffer as a size 11 array)
Control[4]: 5 (I'm only using 4 registers, but I'll give myself some padding and since my array is size 11; then 2*5=10 so I won't go past the length of my array.
Control[5]: 16#0400 (first byte is the slot of my NOE, second byte is a lookup index (i.e. if you were using a bridge mux or a gateway))
Control[6]: 192 (next 4 are the IPv4 address, my example is 192.168.0.1)
Control[7]: 168
Control[8]: 0
Control[9]: 1
Control[10]: 7 (Length of request in bytes: 0F 00 10 00 02 01 03)
Control[11]: 0 (system reserved length of response)
So the rest of my Buffer is as follows:
Buffer[5]: 16#0000 (Padding from Control[4])
Buffer[6]: 16#0000 (First part of response)
Buffer[7]: 16#0000 (Second part of response)
Buffer[8]: 16#0000 (Third part of response)
Buffer[9]: 16#0000 (Unused)
Buffer[10]: 16#0000 (Unused)
Buffer[11]: 16#0000 (Unused)
From the Modbus Application Protocol the response is as follows:
Function Code: 1 byte
Starting Address: 2 bytes
Quantity of outputs 2 bytes
So if my device is following the Modbus standard my buffer should look like the following to mirroring my request:
Buffer[6]: 16#0F00
Buffer[7]: 16#1000
Buffer[8]: 16#0200
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-05-15 06:18 AM
Should probably start this as a new post rather than hopping on someone else's, but a few things:
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.