powerpoint presentation - welcome to...
Post on 30-Aug-2020
3 Views
Preview:
TRANSCRIPT
CPE 323: MSP430 Digital I/O
Aleksandar Milenkovic
Electrical and Computer EngineeringThe University of Alabama in Huntsville
milenka@ece.uah.edu
http://www.ece.uah.edu/~milenkaCPE 323 Intro to Embedded Computer Systems 1
Outline
• System View
• Digital I/O
• Address Mapping
• Port Operations
• Schematics
• Configuration
CPE 323 Intro to Embedded Computer Systems 2
System View Digital IO Address Mapping Operation Schematics Configuration
Functional Block Diagram of MSP430xG461x
CPE 323 Intro to Embedded Computer Systems 3
System View Digital IO Address Mapping Operation Schematics Configuration
Functional Block Diagram of MSP430xF20x3
CPE 323 Intro to Embedded Computer Systems 4
System View Digital IO Address Mapping Operation Schematics Configuration
Digital Input, Output
• Digital inputs – they are either on or off
• Inputs from humans or sensors
• E.g., switches, sensors (e.g., door is locked, button is pressed, ...)
• Digital outputs – set them on or off
• Light-emitting diodes (LEDs), seven segment displays, liquid-crystal displays (LCDs)
• MSP430 can supply these directly if they work from the same voltage and draw a sufficiently small current
• Digital input/output ports (P1 – Pn), n=2 ... 10
• Almost all pins can be used either for digital I/O or for other (special) functions
• Their operation must be configured on start up
CPE 323 Intro to Embedded Computer Systems 5
System View Digital IO Address Mapping Operation Schematics Configuration
Digital Input, Output (cont’d)
• Ports P1 and P2 have interrupt capability
• Each interrupt for the P1 and P2 input lines can be individually enabled and configured to provide an interrupt on a rising edge or falling edge of an input signal
• The digital I/O features include:
• Independently programmable individual I/Os
• Any combination of input or output
• Individually configurable P1 and P2 interrupts
• Independent input and output data registers
• The digital I/O is configured with user software
CPE 323 Intro to Embedded Computer Systems 6
System View Digital IO Address Mapping Operation Schematics Configuration
CPE 323 Intro to Embedded Computer Systems 7
01234567
P1.
P10.
P2.
Input Register PxIN
Output Register PxOUT
Direction Register PxDIR
Interrupt Flag Register PxIFG
Interrupt Enable Register PxIE
Interrupt Edge Select Register PxIES
Function Select Register PxSEL
P3.
…
Port1Port2
Port3
Port10
yes yes
yes no
yes no
yes no
yesyes
yesyes
yesyes
P4.
…
Parallel Ports
System View Digital IO Address Mapping Operation Schematics Configuration
IAR View of Digital I/O Ports
CPE 323 Intro to Embedded Computer Systems 8
P1, P2P1, P2, Expanded view
P3, P4, Expanded view
System View Digital IO Address Mapping Operation Schematics Configuration
MSP430FG4618 Port Address Mapping
• Notice addresses of P9.IN and P10.IN, P9.OUT and P10.OUT
• Other pairs of register too
• What are implications?
CPE 323 Intro to Embedded Computer Systems 9
System View Digital IO Address Mapping Operation Schematics Configuration
MSP430F2013 Port Address Mapping
• There is one 8-bit I/O port implemented—port P1—and two bits of I/O port P2
• Each I/O has an individually programmable pullup/pulldown resistor
CPE 323 Intro to Embedded Computer Systems 10
System View Digital IO Address Mapping Operation Schematics Configuration
Digital I/O Registers: Operation
• Input Register PnIN
• Each bit in each PnIN register reflects the value of the input signal at the corresponding I/O pin when the pin is configured as I/O function.
• Bit = 0: The input is low
• Bit = 1: The input is high
• Output Registers PnOUT
• Each bit in each PnOUT register is the value to be output on the corresponding I/O pin when the pin is configured as I/O function and output direction.
• Bit = 0: The output is low
• Bit = 1: The output is high
CPE 323 Intro to Embedded Computer Systems 11
Do not write to PxIN. It will result in increased current consumption
System View Digital IO Address Mapping Operation Schematics Configuration
Digital I/O Registers: Operation
• Direction Registers PnDIR
• Bit = 0: The port pin is switched to input direction
• Bit = 1: The port pin is switched to output direction
• Function Select Registers PnSEL
• Port pins are often multiplexed with other peripheral module functions.
• Bit = 0: I/O Function is selected for the pin
• Bit = 1: Peripheral module function is selected for the pin
CPE 323 Intro to Embedded Computer Systems 12
System View Digital IO Address Mapping Operation Schematics Configuration
Digital I/O Registers: Operation
• Interrupt Flag Registers P1IFG, P2IFG(only for P1 and P2)
• Bit = 0: No interrupt is pending
• Bit = 1: An interrupt is pending
• Only transitions, not static levels, cause interrupts
• Interrupt Edge Select Registers P1IES, P2IES
• Each PnIES bit selects the interrupt edge for the corresponding I/O pin (n=1, 2).
• Bit = 0: The PnIFGx flag is set with a low-to-high transition
• Bit = 1: The PnIFGx flag is set with a high-to-low transition
CPE 323 Intro to Embedded Computer Systems 13
System View Digital IO Address Mapping Operation Schematics Configuration
Digital I/O Registers: Operation (Specific for MSP430F2xxx)
• Pullup/Pulldown Resistor Enable Registers PxREN
• Each bit in each PxREN register enables or disables the pullup/pulldown resistor of the corresponding I/O pin
• The corresponding bit in the PxOUT register selects if the pin is pulled up or pulled down
• Bit = 0: Pullup/pulldown resistor disabled
• Bit = 1: Pullup/pulldown resistor enabled
CPE 323 Intro to Embedded Computer Systems 14
System View Digital IO Address Mapping Operation Schematics Configuration
Digital I/O Registers: Operation (Specific for MSP430F2xxx)
• Two select registers PxSEL and PxSEL2
CPE 323 Intro to Embedded Computer Systems 15
System View Digital IO Address Mapping Operation Schematics Configuration
MSP430FG4618 P1.0-5 Schematic
CPE 323 Intro to Embedded Computer Systems 16
System View Digital IO Address Mapping Operation Schematics Configuration
MSP430F20x3 Port P1 Schematic
CPE 323 Intro to Embedded Computer Systems 17
System View Digital IO Address Mapping Operation Schematics Configuration
Configuring Unused Pins
• Unused pins must never be left unconnected in their default state as inputs
• Floating (unconnected) input – both pull-up and pull-down may be causing shoot-through current => deplete your power source
• What should you do?
• Wire unused pins externally to VGND or VDD and configure them as inputs (Warning: if you accidentally configure them as outputs you may damage the chip)
• Leave the pins unconnected externally, but connect them internally to VGND or VDD (applicable only to MSP430F2xx devices)
• Leave the pins unconnected and configure them as outputs (Warning: do not short circuit them with the probe)
CPE 323 Intro to Embedded Computer Systems 18
System View Digital IO Address Mapping Operation Schematics Configuration
top related