Low Byte & High Byte

dbh6

Lifetime Supporting Member
Join Date
Jan 2013
Location
Central, NJ
Posts
552
Hello all

I had a question regarding a Low byte and high Byte to an INT.

Ex. say you have a binary 8 bit low byte representation of 10110111 which equates to 183 decimal value and then a high byte representation 10001111 which equates to 143 decimal, what is the theoretical way of "combining" the low byte and high byte in "binary" then reading the value as one (word). I know in logix 5000 their are ways of combining these two, but that is not the method I'm looking for, I'm specifically looking for the method we learned in school how to equate this. I just can't remember how to do it. Thanks in advance
 
@ peter that works, but do you have a more universal approach to doing this, because some processor don't have shift registers, i remember their was a way to multiply by 256 or something, i just don't remember.
 
You shift bits left by multiplying by 2n where n is the number of bits you want to shift. An 8 bit shift is 256.

With a CPT statement it is

CPT DestinationTag (HigByteTag*256)+LowByteTag
 
Last edited:
@ TConnolly thanks, that was the approach i was looking for, followed with that you included a "+" operator in your CPT instructin. So my question follows is that an addition of the resultant binary numbers or an "OR" of the binary numbers to get the low and high byte as a word? Unless we are taking the low and high bytes as decimals?? please explain.
 
In this case it doesn't matter if you OR or ADD. After the shift the lower 8 bits are all 0, so there are no bit carries.
 

Similar Topics

Im new at this whole programming thing, i am using a slc505 (ab) to send data to an ultra3000 servo indexing drive (on devicenet). I want to send...
Replies
1
Views
2,939
Hi, The hardware is: Click Plc model # CO-O1DD1-O HMI model # S3ML-R magnetic-inductive flow meter model # FMM100-1001. I will set the flow meter...
Replies
4
Views
117
I'm a beginner in the automation field and I've set up an automation system connecting several devices (datalogger, radio, etc.) via Modbus RS485...
Replies
5
Views
197
Anyone have issues with RSLinx being very slow to open. It sometimes will say "Checking Activation" at the bottom for what seems like an...
Replies
2
Views
132
I'm a newbie who started a job as a repair tech recently. I've had plenty of luck with ABBs, Allen Bradleys, and a few others, but I can't seem to...
Replies
1
Views
156
Back
Top Bottom