13.2 Compute the LSB and MSB values

Use the following formulas to compute the LSB and MSB values:

LSB = (D/A Code) AND 255 ;keep only the low 8 bits

MSB = int((D/A code) / 256) ;strip off low 8 bits, keep 4 high bits

Example: Output code = 1776

LSB = 1776 AND 255 = 240 (F0 Hex)

MSB = int(1776 / 256) = int(6.9375) = 6

(In other words, 1776 = 6*256 + 240)

Last updated