markw444 Posted July 9, 2018 Report Share Posted July 9, 2018 Hello, I've successfully connected a small network of Samba HMI/PLCs, and have had my computer running a program to pull data through MODBUS TCP (computer is master, all Samba units are slaves). I can successfully pull data from any of the 256 MIs as their indexing starts at 0 in regards to function code 3: read holding registers. However, I need to pull data from one of the memory long values. I could copy the data into two MIs (as suggested on another forum post), but I would prefer not to in order to limit register use for future changes to my ladder logic. The help files list the starting pointer value for MLs as 5100 in Standard Vision products, but I could not successfully pull data using this as a starting address in my MODBUS commands. I have tried finding documentation regarding this question, but I may be searching in the wrong place. If anyone knows the starting index for memory long values in Samba units, I would greatly appreciate that information. Thanks, Mark Quote Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted July 9, 2018 MVP 2023 Report Share Posted July 9, 2018 I thought Sambas were an Enhanced Vision product. If that's the case, the starting index is 7000h (28,672) for an ML. In the VisiLogic Help, look for MODBUS Slave Addresses. Quote Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted July 9, 2018 MVP 2023 Report Share Posted July 9, 2018 Sambas are Enhanced Visions. I don't know why they complicate things with hex, but Flex is correct: Don't forget everything is 32 bits long in this region, but the address pointers are 16 bit. The variables in your computer program must also be long integers. Modbus is at its core a 16 bit protocol so reading a long you specify a length of 2 for the Read command for each ML you want. To read 2 MLs you need to specify a length of 4. ML 0 is at 28,672. ML 1 is at 28,674. And so on. If you open the built-in Calculator app in Windows the menu in the upper left corner allows you to select "Programmer" mode. It's a very handy tool for crossing hex values to decimal. Joe T. Quote Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted July 10, 2018 MVP 2023 Report Share Posted July 10, 2018 2 hours ago, Joe Tauser said: ML 0 is at 28,672. ML 1 is at 28,674. And so on. *28,673 Quote Link to comment Share on other sites More sharing options...
markw444 Posted July 10, 2018 Author Report Share Posted July 10, 2018 Thank-you for the replies! I can now read the correct values from the MLs, but only if I query using a start address of 28672. The ML I'm attempting to read from is ML 3, which I would suppose would start at 28678. As a random test value, I set ML 3 = 73333. If I send a MODBUS query for registers starting address 28672 and length 10 (00 03 00 00 00 06 80 03 70 00 00 0a), I receive a response indicating register 28678 = 1e 75, and 28679 = 00 01, meaning that ML 3 = 00 01 1e 75 = 73333. I'm using both WireShark (which recognizes MODBUS commands/replies) and my own C# program to interpret the slave response. This matches what I expected. However, if I send a MODBUS query for registers starting at address 28678 and length 2 (00 03 00 00 00 06 80 03 70 06 00 02), I receive a response indicating registers 28678 and 28679 are zero (ML 3 = 0). I can simply parse the data as necessary, but I wonder why this occurs. Again, thank-you! Quote Link to comment Share on other sites More sharing options...
Isakovic Posted July 12, 2018 Report Share Posted July 12, 2018 Can you use other "strange" function codes? I've seen that code 35: works for ML, DW and timer registers. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.