13.07.2015 Views

Data Acquisition

Data Acquisition

Data Acquisition

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

F.8 Internal representation of informationAs has been discussed previously, there are two kinds of information that must berepresented within the PLC:• Program information• <strong>Data</strong> informationThere are two types of data:• Numeric• Alphanumeric or charactersNumeric data can be further subdivided into• Integers• Floating point numbersEach of these types must have the sign of the number encoded as well. There are a fewmethods of encoding this numeric data:In this example, the most significant bit represents the sign bit. Hence, 2 would berepresented in an 8-bit notation as:0 0 0 0 0 0 1 0–2 would be represented as:1 0 0 0 0 0 1 0Although easy to visualize the encoding of the number, it is not popular because of thecomplexity of performing arithmetic operations.The approach here is to take the mathematical complement of the number to derive itsnegative value. For example, the number 2 would have the representation of:0 0 0 0 0 0 1 0The representation for –2 would be (complementing the above byte):1 1 1 1 1 1 0 1(The MSB is still the sign bit and in this example, it is 1 indicating a negative number.)Unfortunately with this approach, the rules of normal binary arithmetic do not work ifthe signs are different.This is probably the most effective approach and its calculation is as follows:• Take the number and complement each bit.• Add ‘1’ to the least significant bit.For example:‘+2’ is represented as: 0000 0010‘–2’ is represented as (1’s complement) 1111 1101(2’s complement) 1111 1110

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!