{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

aLec16_localVariables

aLec16_localVariables - Introduction to Embedded...

This preview shows pages 1–3. Sign up to view the full content.

Introduction to Embedded Microcomputer Systems Lecture 16.1 Jonathan W. Valvano Recap Finite State Machines Pointer implementation Overview Fixed-point: why, when, how Local variables: scope and allocation How these concepts apply to C Binding, allocation, access, deallocation Floating point numbers ANSI/IEEE Std 754-1985 single-precision (32-bit), double-precision (64-bit), and double-extended precision (80-bits). The floating-point format Bit 31 sign, s =0 for positive, s =1 for negative Bits 30:23 8-bit biased binary exponent 0 e 255 Bits 22:0 24-bit mantissa, m expressed as a binary fraction a binary 1 as the most significant bit is implied m = 1 .m 1 m 2 m 3 ... m 23 se 7 e 0 m 1 m 23 f = (-1) s • 2 e-127 m 10.1. Fixed-point numbers Fixed point numbers Why? (wish to represent non-integer values) Next lab measures distance from 0 to 3 cm E.g., 1.234 cm When? (range is known, range is small) Range is 0 to 3cm Resolution is 0.003 cm How? (value = Integer* Δ ) 16-bit unsigned integer Δ = 10 -3 decimal fixed-point Range becomes 0.000 to 65.535 Output an integer. Assume integer, n, is between 0 and 9999. not very pretty OutChar(\$30+n/1000) ;thousand’s digit n = n%1000 OutChar(\$30+n/100) ;hundred’s digit n = n%100 OutChar(\$30+n/10) ;ten’s digit OutChar (\$30+n%10) ;one’s digit Output a fixed-point number. Assume the integer part of the fixed point number, n, is between 0 and 9999. very pretty

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

View Full Document
Introduction to Embedded Microcomputer Systems Lecture 16.2 Jonathan W. Valvano OutChar(\$30+n/1000) ;thousand’s digit n = n%1000 OutChar(\$2E) ;decimal point OutChar(\$30+n/100) ;hundred’s digit n = n%100 OutChar(\$30+n/10) ;ten’s digit OutChar (\$30+n%10) ;one’s digit 7.3. Local Variables Introduction scope => from where can this information be accessed private means restricted to current program segment public means any software can access it allocation => when is it created, when is it destroyed dynamic allocation using registers or stack permanent allocation assigned a block of memory
This is the end of the preview. Sign up to access the rest of the document.
• Spring '11
• YERRABALLI
• Local variable, Fixed-point arithmetic, pt pt pt, Embedded Microcomputer Systems, Pt Pt Pt Pt Pt Pt Pt Pt Pt Pt Pt Pt Pt

{[ snackBarMessage ]}

Page1 / 6

aLec16_localVariables - Introduction to Embedded...

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

View Full Document
Ask a homework question - tutors are online