This preview shows pages 1–6. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: 81EE 319KIntroduction to MicrocontrollersLecture 8:Fixed Point Numbers, Local Variables, Binding, Allocation, Access, Deallocation Ramesh Yerraballi82Fixed Point NumbersWhy? (wish to represent noninteger 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 16bit 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 Yerraballi83Fixed Point Numbers: DecimalDecimal (Value = I*10m)I is a 16bit unsigned integer = 10m decimal fixedpoint 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*103=> I = Integral approximation of(3.14159*103)I = Integral approximation of(3141.59) I = 3142Decimal Fixedpoint numbers are humanfriendlyRamesh Yerraballi84Fixed Point Numbers: BinaryBinary(Value = I*2m)I is a 16bit unsigned integer = 2m binary fixedpointFor example with m=8 (resolution of 1/256)What is represented as in binary Fixed Point? (3.14159)= I*28=> I = Integral approximation of(3.14159*28)I = Integral approximation of(804.2477) => I = 804Decimal Fixedpoint numbers are computerfriendlyRamesh Yerraballi85OutputOutput an integer. Assume integer, n, is between 0...
View Full
Document
 Spring '08
 BARD

Click to edit the document details