E21 Lecture #19

Microcontrollers

Design is a top-down process

Internal memory organization

How many registers?

  • Depends on CISC/RISC and memory size
  • PIC16C73: registers are the RAM (192 8-bit registers)

What registers are needed for the control unit?

  • Instruction register
  • PC [Pic = PC, PCLATH]
  • Stack registers
  • Status register

What registers are needed for the data path?

  • Temporary holding registers [PIC = all registers]
  • Accumulator [PIC = W register]
  • Ports for I/O
  • Indirect address register

What special-purpose registers exist?

  • Accumulator
  • Stack
  • I/O ports
  • Status register
  • PC
  • Instruction register

How are the registers connected?

  • Most are connected by a single bus
  • PIC: since the W register always must be one of two binary arguments, don't need to move more than one item on the bus at any specific time

I/O organization

Memory-mapped I/O versus an I/O instruction set

6811 - I/O instruction set

PIC - memory-mapped

I/O functions are register controlled

I/O pin design for flexible use

A/D and input/output port

  • PortA: RA5, RA3:RA0 pins
    • configurable as inputs or outputs
    • configurable as digital or analog inputs
    • open wire to the A/D converter
    • AND gate to input latch, latch is input enabled on reads only
    • Logic connects output latch and register control latch to ouput CMOS drivers
  • PortA: RA4 pin
    • configurable as digital input or digital output
    • Schmitt Trigger input buffer isolates input and peripheral module from the pin
    • Open drain means the output can be connected in a wired-OR fashion (negative logic)
  • PortB: RB3:RB0
    • Has a weak pull-up feature, which means if the output pin is not connected to ground it will float high (if configured as an output
    • Output goes through a tri-state latch (TTL driver)
  • PortB: RB7:RB4
    • Also has a weak pull-up
    • Allows interrupt on change feature (can use it to wake up the processor when someone hits a key, for example)
    • Old value of the input is compared with the new latched value to see if there has been any change.
  • PortC: RC7:RC0
    • Can act as inputs or outputs
    • Can select between a peripheral output or the port C output
    • Peripheral input goes through a Schmitt trigger to isolate it from the pin
    • CMOS output driver
  • PortD: RD7:RD0
    • Simple configurable input/output pins