View Full Version : 16 bit input in word address
May 15th, 2002, 09:11 AM
Is there a way to put 16 bit inputs into a single 16 bit word address.
The only way I can think of off the top of my head is to:
Add 1 if Bit 1 is high
Add 2 if Bit 2 is high
Add 4 if Bit 3 is high
Add 8 if Bit 4 is high
Is there any easier way to do this? I just want something simple without alot of work. It seems that there is an easier way to me that I am overlooking
May 15th, 2002, 09:35 AM
What brand PLC are you using?
It is really simple to address 16 bit inputs as a single 16 bit word in most, if not all PLC's.......
An AB SLC500 example:
These Input "bits" can be addressed as a single 16 bit word- I:1.0
May 15th, 2002, 10:10 AM
In most platforms, assuming the bits are contiguous, you can use some sort of move or copy function to copy the word for the bits into a new register. If you identify the PLC model someone here is sure to give you specifics.
If the bits are not contiguous (all in a sequence and contained in one word like 93's example) but random, then I don't think there is an easy approach.
May 15th, 2002, 11:43 AM
If the bits are not in order, you can use a simple brute force method that uses normally open contacts for the bits you are converting to energize the bit level coils of an integer register i.e. N7:0/0 - N7:0/15 as well.
Don't forget that the 16th bit (/15) is a sign bit. If you are trying to generate an unsigned 16 bit value you will need to include a float register i.e. F8:0 and monitor the sign bit of the integer. If the sign bit is off, move the integer value directly to the float. If the sign bit is on, add 65536 to the integer value and the sum should be placed in the same float register.
It seems like we are talking about AB PLC's but if the PLC type is from a different family, different rules will apply.