Download presentation
Presentation is loading. Please wait.
Published byDiane Cole Modified over 8 years ago
1
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
2
Parallel Ports (1) Uses Direct user interface (switches, LEDs etc) Direct user interface (switches, LEDs etc) Input measurement information (from sensors) Input measurement information (from sensors) Output control information (control a pump or a motor etc) Output control information (control a pump or a motor etc) Bulk data transfer (to move data to and from the µc) Bulk data transfer (to move data to and from the µc) 2
3
Parallel I/O (2) Output Structure 3
4
Parallel I/O (2) Input Structure 4
5
Parallel I/O (2) Combined I/O Structure 5
6
Modeling Output Lines 6
7
Special Cases: Schmitt trigger inputs 7
8
Special Cases: Open Drain Output 8
9
Connecting to Parallel Ports Switches (1) 9
10
Connecting to Parallel Ports Switches (2) 10
11
Connecting to Parallel Ports: LEDS Characteristics 11
12
Connecting to Parallel Ports: Driving LEDS 12
13
Parallel I/O ports (3) Main Features Simple memory mapped access Simple memory mapped access Can be configured through software as either input or output Can be configured through software as either input or output Ability to set or reset individual bits Ability to set or reset individual bits Can have internal pull-ups Can have internal pull-ups Can drive small loads like LEDs Can drive small loads like LEDs Can be multifunction Can be multifunction Different capability for pins (i.e. larger current) Different capability for pins (i.e. larger current) 13
14
Parallel I/O ports (4) General I/O pins are the simplest of peripherals used to monitor and control other devices. 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 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. 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). Example: Initializing PORTB (PORTB is an 8-bit port. Each pin is individually configurable as an input or output). bcf STATUS, RP0 ; select bank0 bcf STATUS, RP0 ; select bank0 bcf STATUS, RP1 bcf STATUS, RP1 clrf PORTB ; clear PORTB output data latches clrf PORTB ; clear PORTB output data latches bsf STATUS, RP0 ; select bank1 bsf STATUS, RP0 ; select bank1 movlw 0xCF ; value used to initialize data direction movlw 0xCF ; value used to initialize data direction movwf TRISB ; PORTB =inputs, PORTB =outputs, movwf TRISB ; PORTB =inputs, PORTB =outputs, ; PORTB =inputs ; PORTB =inputs 14
15
Relationship between TRIS and PORT Registers 15
16
16F84 PORTB Circuit 16
17
16F84 Output Electrical Characteristics (1) 17
18
16F84 Output Electrical Characteristics (2) 18
19
The Clock Oscillator: Major Types 19
20
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
21
The Clock Oscillator: Major Modes 21
22
Power Supply Requirements 22
23
23
24
Reset Concepts There are five kinds of Reset for the microcontroller: 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
25
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
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.