plcpeople / nodeS7

Node.JS library for communication to Siemens S7 PLCs
MIT License
356 stars 120 forks source link

Address conversion #128

Closed plurimediatech closed 1 year ago

plurimediatech commented 1 year ago

Hello,

I'm working with a client who installed a new Siemens Simotion machine. We previously developed an interactive web-based dashboard to manage his Siemens 1500 machine. The new machine uses a completely different address format and I'm not sure if and how a conversion is possible:

New Format: 10-01-00-01-00-67-84-00-04-80 Old Format: DB51.DBX100.1

Attached the "conversion diagram" given with the technical specs, the same for both machines.

image

Thank you in advance for any advice.

plcpeople commented 1 year ago

The address can be converted fairly easily: First byte is 10h always Second 01 = data type = bool Third, fourth 0001 = Repetition factor = 1 in this case (Array of only 1 so a single item) DB number is 67 hex = 103 decimal Memory area 84 = Data Block (DB) The last 3 bytes can be considered together as a bit offset, or divided by 8 to get a byte offset, in this case 480 hex =1152 dec = 144 when divided by 8 to convert to a byte offset.

So for your example, you could use DB103.DBX144.0 which would be a bit in the data block in the format you are used to.

Attached is a screenshot of the various relevant data types from the S7 help on the "any pointer": image

And the memory areas: image