Parallel Ports, Clock Oscillator and Power Supply Issues

Download Report

Transcript Parallel Ports, Clock Oscillator and Power Supply Issues

Parallel Ports, Power Supply and the
Clock Oscillator
Material to be covered
Parallel I/O ports
 Interfacing external switches and LEDs
 Clock Oscillator circuits
Power supply requirements

Parallel Ports (1)
Uses




Direct user interface (switches, LEDs etc)
Input measurement information (from
sensors)
Output control information (control a
pump or a motor etc)
Bulk data transfer (to move data to and
from the µc)
2
Parallel I/O (2)
Output Structure
3
Parallel I/O (2)
Input Structure
4
Parallel I/O (2)
Combined I/O Structure
5
Modeling Output Lines
6
Special Cases: Schmitt trigger inputs
7
Special Cases: Open Drain Output
8
Connecting to Parallel Ports
Switches (1)
9
Connecting to Parallel Ports
Switches (2)
10
Connecting to Parallel Ports: LEDS
Characteristics
11
Connecting to Parallel Ports:
Driving LEDS
12
Parallel I/O ports (3)
Main Features







Simple memory mapped access
Can be configured through software as
either input or output
Ability to set or reset individual bits
Can have internal pull-ups
Can drive small loads like LEDs
Can be multifunction
Different capability for pins (i.e. larger
current)
13
Parallel I/O ports (4)




General I/O pins are the simplest of peripherals used to monitor and
control other devices.
For most ports, the I/O pin’s direction (input or output) is controlled by
the data direction register TRISx (x=A,B,C,D,E): a ‘1’ in the TRIS bit
corresponds to that pin being an input, while a ‘0’ corresponds to that
pin being an output
The PORTx register is the latch for the data to be output. Reading
PORTx register read the status of the pins, whereas writing to it will
write to the port latch.
Example: Initializing PORTB (PORTB is an 8-bit port. Each pin is
individually configurable as an input or output).
bcf
bcf
clrf
bsf
movlw
movwf
STATUS, RP0
; select bank0
STATUS, RP1
PORTB
; clear PORTB output data latches
STATUS, RP0
; select bank1
0xCF
; value used to initialize data direction
TRISB
; PORTB<7:6>=inputs, PORTB<5:4>=outputs,
; PORTB<3:0>=inputs
14
Relationship between TRIS and
PORT Registers
15
16F84 PORTB Circuit
16
16F84 Output Electrical Characteristics (1)
17
16F84 Output Electrical Characteristics (2)
18
The Clock Oscillator: Major Types
19
Oscillator Configurations

The PIC16F84A can be operated in four
different oscillator modes. The user can
program two configuration bits (FOSC1 and
FOSC0) to select one of these four modes:
•
•
•
•
LP Low Power Crystal
XT Crystal/Resonator
HS High Speed Crystal/Resonator
RC Resistor/Capacitor
20
The Clock Oscillator: Major Modes
21
Power Supply Requirements
22
23
Reset Concepts

There are five kinds of Reset for the
microcontroller:
•
•
•
•
•
Power-on Reset (POR)
MCLR during normal operation
MCLR during SLEEP
WDT Reset (during normal operation)
WDT Wake-up (during SLEEP)
24
Power-Up Timer & Oscillator
Startup Timer


Power-up Timer (PWRT) provides a fixed 72
ms nominal time-out (TPWRT) from POR.
The Oscillator Start-up Timer (OST) provides
a 1024 oscillator cycle delay (from OSC1
input) after the PWRT delay ends
25