Exam Review - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

Exam Review

Description:

CPU Saves Status, and PC and Jumps to pre-defined address ... Potentiometer. Resolver. Absolute Encoders. Incremental Encoders. Phase A. Phase B. Index pulse ... – PowerPoint PPT presentation

Number of Views:51
Avg rating:3.0/5.0
Slides: 14
Provided by: eece5
Category:

less

Transcript and Presenter's Notes

Title: Exam Review


1
Exam Review
  • Embedded Programming

2
External Interrupt
  • Special Exception
  • CPU Saves Status, and PC and Jumps to pre-defined
    address 0x500
  • ISR
  • Determine what caused the interrupt
  • Process it, doing as little as possible
  • Restore state of machine
  • Return from interrupt
  • Fundamental mechanism for multi-tasking

3
Feedback
  • Tachometer
  • Potentiometer
  • Resolver
  • Absolute Encoders
  • Incremental Encoders
  • Phase A
  • Phase B
  • Index pulse
  • Quadrature Decoding
  • MPC565 special Feature
  • Time Processing Unit
  • Parameter Ram
  • Host Service Request
  • Host Sequence Request
  • QDEC function
  • Library of interface functions

4
Binary and Hexidecimal Representation of Numbers
  • 4 bit 2s compliment
  • MSB is sign
  • Addition is simple
  • 7 0x7 0111b
  • 6 0x6 0110b
  • 5 0x5 0101b
  • 4 0x4 0100b
  • 3 0x3 0011b
  • 2 0x2 0010b
  • 1 0x1 0001b
  • 0 0x0 0000b
  • -1 0xF 1111b
  • -2 0xE 1110b
  • -3 0xD 1101b
  • -4 0xC 1100b
  • -5 0xB 1011b
  • -6 0xA 1010b
  • -7 0x9 1001b
  • -8 0x8 1000b

5
C Coding for Embedded Systems
  • Bit wise operations
  • Writes and Reads of specific address
  • Pointers
  • Careful attention to data types
  • Understand mapping from data structures into
    memory

6
Operators
  • Arithmetic
  • ,-,,/, and
  • Always result in a number
  • Relational
  • ,lt,gt,!,gt,and lt
  • Always result in true or false (1 or 0)
  • Logical
  • ,,!
  • Treat both sides as true or false, result is true
    or false
  • Bitwise
  • ,,,,ltlt,gtgt
  • Act on bit fields, result is bit fields

7
Setting and Clearing Bits
  • Masks
  • Register ! MY_BIT_MASK // sets
  • Register MY_BIT_MASK // clears Register
    1ltlt6 // sets 7th bit
  • Register (1ltlt6) // clears 7th bit
  • Structures with bit fields
  • MPIO.DDR.B.D0 0 // sets one bit
  • MPIO.DDR.B.D0 1 // clears one bit

8
Checking for bit set
  • If (MPIO.DR.R 0xFEF)
  • // register matches all bits in mask
  • If(MPIO.DR.B.D0 0)
  • // individual bit is clear

9
Type conversion and casting
  • Hard coded numbers must be interpreted by the
    compiler as some data type.
  • Int
  • 0x12
  • 145
  • Double
  • 12.
  • 1.5
  • Char
  • q

10
Conversion from one type to another will happen
  • float a2 // converts int to float
  • int b2. // converts double to int
  • char c 0xfe // converts int to char
  • a 6b/c // does 6b as int
  • // converts c to int,
  • // does integer division
  • // coverts results to a float
  • // result will be truncated

11
C preprocessor
  • include
  • define
  • ifdef
  • pragma

12
Functions
  • Prototypes
  • Parameters
  • Pass by value
  • Pass by pointer
  • Return values

13
Writing to a specific memory address
  • Pointer
  • VUINT32 ptr (VUINT32) 0x12345678
  • ptr 15
  • Structures
Write a Comment
User Comments (0)
About PowerShow.com