Presentation is loading. Please wait.

Presentation is loading. Please wait.

General Purpose I/O.

Similar presentations


Presentation on theme: "General Purpose I/O."— Presentation transcript:

1 General Purpose I/O

2 PORTS Ports provide an interface between the processor and the outside world and support variety of I/O functions.

3 68HC11 Ports PORT A PORT B PORT C PORT D PORT E

4 68HC11 Microcontroller

5 PORT B in single-chip mode
General purpose output port (8 pins) Data is output to port B via port B register (PORTB) PORTB is located in the 64-byte register block PORTB address is $1004 (THRSIM simulation) or $04 (68HC11 MCU)

6 Programming Port B Write a program to make port B high ORG $0200 LDAA #$FF STAA $1004 Write a program to make PB0-PB2 high and the rest low LDAA #%

7 Port B in Expanded Mode Port B pins are used as the upper byte of the 16-bit external address bus (ADDR8-ADDR15)

8 Port C In Single-Chip mode
8 bit general purpose bidirectional port It consist of an 8-bit data register (PORTC). $1003 or $03. It consist of an 8-bit data direction register (DDRC). $1007 or $07.

9 DDRC Each bit in the DDRC controls the direction of the corresponding bit in the port c register Ex. Make port C input, read data from port C and store it in $0400. ORG $0200 CLR $1007 ; Port c input LDAA $1003 ; read input STAA $0400

10 More examples Ex. Make port C output, make all output high. ORG $0200 LDAA #$FF STAA $1007 STAA $1003

11 Port C in Expanded mode Port C pins are used as the lower byte of the 16-bit external address bus (ADDR0-ADDR7) and external data bus (D0-D7)

12 Bit level operation instructions
BSET BCLR BITA BITB BRSET BRCLR

13 PORT A 8-BIT general purpose I/O port.
PA4-PA6 are outputs or output compare pins. PA0-PA2 are inputs or input-edge-detected pins. PA3 & PA7 are programmable I/O. These two lines are controlled by two data direction control bits. PACTL ($1026 or $26) Port A data register allows data to flow in and out of the port. ($1000 or$00) Bit 6 in PACTL register is used to switch port A function from general purpose I/O to input capture and output compare operation. PAEN = 0 GPIO, PAEN = 1 input capture/output compare

14 Port D 8-bit I/O port. PD0 –PD5 are programmable I/O.
DDRD ($1009 or $09) controls the direction of the I/O. Port D data register ($1008 or $08). PD0 and PD1 are used for serial transmission. PD6 and PD7 are used in Multiplexed mode for AS and RW signals.


Download ppt "General Purpose I/O."

Similar presentations


Ads by Google