Step7: Accessing individual bits of a double word (DBD)

MartyW

Member
Join Date
Nov 2009
Location
New Jersey
Posts
23
A scale module the PLC communicates with feeds back a double word (DBD) that contains status information: 32 defined status bits. In this case it dumps it into a data block at DB21.DBD26. I assumed that I could address DB21.DBX 26.0, 26.1, etc. to look at the individual bits. Looking at the binary representation of the DBD, the information is correct. However may attempts at addressing each item aren't giving the proper values. I have tried assuming that 26.0 has the most significant bit and assuming it has the least significant bit. Either way seems to give incorrect results.

Any ideas?
 
DoubleWord is Word1..Word2
Word is Byte1..Byte2
Byte is 7..0

This means it goes:

26.7..26.0, 27.7..27.0, 28.7..28.0, 29.7..29.0
MSB - - - - - - - - - - - - - - - - - - - - LSB


Open the LAD/STL/FBD editor and do a help search on: DWORD Data Type
 
I figured it out

Within the Double Word, the individual bytes are addressed in descending order. The bits within the bytes are addressed in ascending order.

So for a double word with address 0 (0.0-3.7), the least significant bit is at 3.0. The most significant bit is at 0.7. A bit strange to this newbie.
 

Similar Topics

Hey all! I'm trying to write a FB where I need to transfer 32 byte of I/O data to an array in the FBs DI. The code I am using is this...
Replies
8
Views
3,970
This is the first time I am working with Simatic Manager Step7 as I started my siemens journey with TIA which is pretty easy and do a lot of stuff...
Replies
3
Views
160
When you download a DB, the values get overwritten by what is in the "actual" column in offline DB. Does this happen at the start of the PLC...
Replies
6
Views
156
Hello Inside a FB, I´m trying to transfer a string from a DB to a IN_OUT var that was define as a UDT. The problem is that i can´t determine the...
Replies
4
Views
145
Hi all, I am trying to convert RSLogix 5000 program to Step7. I need to bit shift left my array of double integers for tracking the product on...
Replies
2
Views
528
Back
Top Bottom