Parallel ports, power supply, and the clock oscillator Chapter Three Dr. Gheith Abandah1
Outline Parallel ports – Technical challenges – Connecting to the parallel port – The PIC 16F84A parallel ports Power supply Clock oscillator Dr. Gheith Abandah2
Data Transfer Almost any embedded system needs to transfer digital data between its CPU and the outside world. – Direct user interface, including switches, keypads, light- emitting diodes (LEDs) and displays – Input measurement information, from external sensors, possibly being acquired through an analog-to-digital converter – Output control information, for example to motors or other actuators – Bulk data transfer to or from other systems or subsystems, moving in serial or parallel form, for example sending serial data to an external memory. Dr. Gheith Abandah3
Output Parallel Ports Dr. Gheith Abandah4
Input Parallel Ports Dr. Gheith Abandah5
Bi-directional Parallel Ports Dr. Gheith Abandah6
Port electrical characteristics Dr. Gheith Abandah7 Modeling a logic gate output. (a) Generalized model. (b) Model of CMOS logic gate output
Schmitt trigger inputs Dr. Gheith Abandah8 Schmitt trigger characteristics. (a) Buffer with Schmitt trigger input. (b) Input/output characteristic
The ‘Open Drain’ output Dr. Gheith Abandah9 (a) An ‘Open Drain’ output. (b) Open Drain output driving load resistor. (c) The ‘Wired- OR’ connection
Connecting to the parallel port (1) Switches Dr. Gheith Abandah10 (a)SPDT connection. (b) SPST with pull-up resistor. (c) SPST with pull-down resistor Pull-up values in the range 10–100 kΩ
Connecting to the parallel port (2) Light-emitting diodes Dr. Gheith Abandah11
Connecting to the parallel port (2) Light-emitting diodes Dr. Gheith Abandah12 Driving LEDs from logic gates. (a)Gate output sourcing current to LED (b)Gate output sinking current from LED
Connecting to the parallel port (2) Light-emitting diodes Dr. Gheith Abandah13
The PIC 16F84A parallel ports Port A – 5 Bits – RA3:RA0 – RA4/T0CKI Port B – 8 Bits – RB0/INT – RB3:RB1 – RB7:RB4: Interrupt on change Dr. Gheith Abandah14
Dr. Gheith Abandah15
Dr. Gheith Abandah16
Dr. Gheith Abandah17
Dr. Gheith Abandah18
Port output characteristics -1 Dr. Gheith Abandah19 VOH vs. IOH (VDD = 3V, −40 to 125◦C) R = 130 Ω
Port output characteristics -2 Dr. Gheith Abandah20 VOL vs. IOL (VDD = 3V, −40 to 125◦C) R = 36 Ω
The clock oscillator Faster clock gives faster execution, but more power consumption. The clock oscillator must give stable and accurate clock signal. Oscillator types: – Resistor–capacitor (RC) Not precise – Crystal or ceramic Precise frequency, fragile, should be near the MC Dr. Gheith Abandah21
Oscillator types Dr. Gheith Abandah22 (a) Resistor–capacitor (RC). (b) Crystal or ceramic
The 16F84A clock oscillator Types: 1)XT – crystal: 1-4 MHz 2)HS – high speed: >= 4 MHz, with ceramic resonators. 3)LP – low power: <= 200 KHz, e.g., kHz (i.e ), 4)RC – resistor-capacitor Dr. Gheith Abandah23
(a) Crystal or ceramic, HS, XT or LP. (b) Resistor– capacitor. (c) Externally supplied clock Dr. Gheith Abandah24
Data Sheet Information Dr. Gheith Abandah25
Power Supply Dr. Gheith Abandah nF decoupling capacitor RC Oscillator
Dr. Gheith Abandah27 16F84A operating conditions
Summary – 1 The parallel port allows ready exchange of digital data between the outside world and the controller CPU. It is important to understand the electrical characteristics of the parallel port and how they interact with external elements. While there is considerable diversity in the logic design of ports, they tend to follow similar patterns. The internal circuitry is worth understanding, as it leads to effective use of ports. The 16F84A has diverse and flexible parallel ports. Dr. Gheith Abandah28
Summary – 2 A microcontroller needs a clock signal in order to operate. The characteristics of the clock oscillator determine speed of operation and timing stability, and strongly influence power consumption. Active elements of the oscillator are usually built in to a microcontroller, but the designer must select the oscillator type, and its frequency and configuration. A microcontroller needs a power supply in order to operate. The requirements need to be understood and must be met by a supply of the appropriate type. Dr. Gheith Abandah29