Reading Bits/Bytes Of A Word

Scada_Newbie

Member
Join Date
Aug 2006
Location
Midlands
Posts
3
Hi All,

Just a question that is PLC and SCADA related.

I am using Wonderwares Intouch 9.5 and a Siemens S7-300 PLC, i have a word that stores a value in the lower byte and i will eventually add a value to store data in the upper byte of the word.

Thats ok, but how do i show this on my scada screen? I know i can see the individual bits of the word:

e.g. MyTag has an address of: DB89,INT36 (And Its Value is 1)
MyTag.00 = 1
MyTag.01 = 0
MyTag.02 = 0
'
'
MyTag.31 = 0
But if i want to know the lower and upper bytes(not the single bits), how would i do this?

Any help would be much apppreciated,

Many Thanks In Advance
 
Read the whole word, and mask off parts of it?
High byte of a word (using integer math) is WORD / 256.
The low byte is then WORD - HIBYTE*256

If WW supports, you can also get the low byte by masking off the top:
LOBYTE = WORD & 0x00FF
 
Bytes In A Words

Sorry, this is my problem.

i do not know if it is possible to read the lower & upper bytes in intouch.

When looking at MyTag Still with an address of DB89,INT36 in intouch it will show a 1 (For Example), what i need to do is find a way to find the value of the two bytes(upper/lower)

Any ideas ?
 
The easiest way to do what you require is to create a couple of new tags in InTouch addressed with the bytes you're using...there are 2 methods of addressing byte variable tags, for the example you give in your first post, these would be

LH/MSB:
DB89,B36 or DB89,BYTE36

RH/LSB:
DB89,B37 or DB89,BYTE37
 
There are a number of ways, as suggested, if the driver allows bit access then read them as bits/bytes or you can read the word as a tag, create internal tags & use simple maths to extract the words into bits/bytes.

Div by 256 etc or do it in a loop have a variable start at 1 and it with the word & if logical 1 (greater than 0 )then set an internal tag array bit(loop tag -1) to 1 else set it to 0, multiply the loop variable by 2 & run the loop until all 16 bits have been checked.

Some time since I used intouch, so not sure about the script required, I used this some years ago to convert 20 or so words into bits as the driver would not read bit values in data words.
 

Similar Topics

Summary: How to remotely toggle BOOL values on a vendor-supplied system having a L24ER PLC? (RSLogix Studio 5000 version 33.01.00) I have a...
Replies
5
Views
1,723
Is this possible? I'm looking at the "Instruction Logic" of the AOI block (which is the *instance*, correct?) (a VFD AOI called "P_VSD"), and on...
Replies
2
Views
1,568
After learning here how to create arrays in RSLogix5000 ver 20.04, I have added some monitoring for a HMI to show 1 of 3 conditions for a bank of...
Replies
2
Views
2,064
Hello, I need to know how to covert a Word red with an Input Parameter in a FB made in SCL. How can I get all the bits in that word ? Can I...
Replies
3
Views
1,488
I'm using Siemens S7. I've an an alarm list of more than 2000 alarms stored from DBX0.0 to DBX379.7. I'm accessing to the PLC with a software in...
Replies
4
Views
1,958
Back
Top Bottom