Lec8 - 8-1EE 319KIntroduction to MicrocontrollersLecture...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 8-1EE 319KIntroduction to MicrocontrollersLecture 8:Fixed Point Numbers, Local Variables, Binding, Allocation, Access, Deallocation Ramesh Yerraballi8-2Fixed Point NumbersWhy? (wish to represent non-integer values)Next lab measures distance from 0 to 3 cmE.g., 1.234 cmWhen? (range is known, range is small)Range is 0 to 3cmResolution is 0.003 cmHow? (value = I*) I (Variable Integer) is a 16-bit unsigned integer. It is stored and manipulated in memory. (Fixed Constant) that represents the resolution. It is not stored but is usually written in comments ; implicit.(What about negative numbers?)Ramesh Yerraballi8-3Fixed Point Numbers: DecimalDecimal (Value = I*10m)I is a 16-bit unsigned integer = 10m decimal fixed-point For example with m=-3 (resolution of 0.001 or milli) the value range is 0.000 to 65.535What is represented as in Decimal Fixed Point? (3.14159) = I*10-3=> I = Integral approximation of(3.14159*103)I = Integral approximation of(3141.59) I = 3142Decimal Fixed-point numbers are human-friendlyRamesh Yerraballi8-4Fixed Point Numbers: BinaryBinary(Value = I*2m)I is a 16-bit unsigned integer = 2m binary fixed-pointFor example with m=-8 (resolution of 1/256)What is represented as in binary Fixed Point? (3.14159)= I*2-8=> I = Integral approximation of(3.14159*28)I = Integral approximation of(804.2477) => I = 804Decimal Fixed-point numbers are computer-friendlyRamesh Yerraballi8-5OutputOutput an integer. Assume integer, n, is between 0...
View Full Document

Page1 / 15

Lec8 - 8-1EE 319KIntroduction to MicrocontrollersLecture...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online