Integer and it's role in a PLC programme

Status
Not open for further replies.

trespaser5

New Member
I'm a bit confused by the role/value of an integer in a PLC programme. My understanding of it was that it represented a 16 bit binary word but in the Texas PLC it can only represent up to 32767 which is 15 bit isn't it ? what's the remaining bit for is it a positive negative indicator ? Or am I way off ?
 

hi,
Bit15, the MSB is the SIGN bit , if bit15 =1 the the Integer is a Negative Value, so the total Integer range is +/-32k.

Note. bit0 is the LSB
 
Last edited:
There are two typical ways to represent signed integers. 1) Two complement and 2) Magnitude + sign
The 1st yields a range of -32768 to +32767. The second -32767 to + 32767 with two representations for zero. A +0 and a -0.

Excess 3 Grey is another. It is used when you only want one bit to change when counting up or down by 1. It's used in some positioning systems.

An unsigned 16 bit integer represents the numbers 0-65535.
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…