digital i o

15
Lecture 3 : Digital I/O & Small Project

Upload: mohamed-bedair

Post on 13-Apr-2017

316 views

Category:

Engineering


2 download

TRANSCRIPT

Page 1: Digital i o

Lecture 3 :

Digital I/O & Small Project

Page 2: Digital i o

Agenda

• Why PIC ??? & Why PIC16F877A• PIC16F877A ports and Pins• Project 1 “Flasher-1”• Project 2 “Flasher-2”• Pull-up & Pull-down Resistors• Project 3 “Button-1”• Project 4 “Button-2”

Page 3: Digital i o

Why PIC ? & Why PIC16F877A

Why PIC ???• PIC is a well-known Microcontroller from a big company ‘Microchip’• Microchip produce big number of controllers with different features • There is a lot of online tutorials on PIC family

Why PIC16F877A ??• Big memory size• Wide range of Peripheral

Page 4: Digital i o

PIC16F877A Ports : PORTA

PORTA : is a 6-Bit Bidirectional port

PORTA Pins

• RA0 , RA1 : Digital I/O , Analog input• RA2 : Digital I/O , Analog input , ADC Ref- , Comparator Ref• RA3 : Digital I/O , Analog input , ADC Ref+• RA4 : Digital I/O , Comparator 1 output• RA5 : Digital I/O , Analog input , SPI salve select , Comparator 2 output

Page 5: Digital i o

PIC16F877A Ports : PORTB

PORTB : is an 8-Bit Bidirectional port , with software weak PULL-UP

PORTB Pins

• RB0 : Digital I/O , External Interrupt • RB1 : Digital I/O• RB2 : Digital I/O• RB3 : Digital I/O , Low voltage ICSP programming enable pin• RB4 : Digital I/O • RB5 : Digital I/O• RB6 : Digital I/O , In circuit Debugger & ICSP Programming Clock• RB7 : Digital I/O , In circuit Debugger & ICSP Programming Data

Note :- RB4 : RB7 have interrupt on-change feature , and only pins configure as input can cause interrupt to occar.

Page 6: Digital i o

PIC16F877A Ports : PORTC

PORTC : is an 8-Bit Bidirectional port

PORTC Pins

• RC0 : Digital I/O , TMR1 Oscillator output , TMR1 external clock input • RC1 : Digital I/O , TMR1 Oscillator input , Capture2 input , compare2 , PWM2• RC2 : Digital I/O , Capture 1 input , Comparator 1 output , PWM 1 output• RC3 : Digital I/O , SPI clock , I2C clock• RC4 : Digital I/O , SPI data in , I2C data I/O• RC5 : Digital I/O , SPI data out• RC6 : Digital I/O , UART transmitter , USART clock• RC7 : Digital I/O , UART receiver , USART Data

Page 7: Digital i o

PIC16F877A Ports : PORTD

PORTD : is an 8-Bit Bidirectional port

PORTD Pins

• RD0 : Digital I/O , Parallel Slave port bit 0• RD1 : Digital I/O , Parallel Slave port bit 1• RD2 : Digital I/O , Parallel Slave port bit 2• RD3 : Digital I/O , Parallel Slave port bit 3• RD4 : Digital I/O , Parallel Slave port bit 4• RD5 : Digital I/O , Parallel Slave port bit 5 • RD6 : Digital I/O , Parallel Slave port bit 6 • RD7 : Digital I/O , Parallel Slave port bit 7

Page 8: Digital i o

PIC16F877A Ports : PORTE

PORTE : is a 3-Bit Bidirectional port

PORTE Pins

• RE0 : Digital I/O , Analog input , Read control for parallel slave • RE1 : Digital I/O , Analog input , Write control for parallel slave• RE2 : Digital I/O , Analog input , chip select control for parallel slave

Page 9: Digital i o

Project 1 “ Flasher-1”

Make project where a LED is connected to RB0 , This LED is on for half Second and off for another half second

Page 10: Digital i o

Project 2 “ Flasher-2”

Make project where an 8 LED is connected To PORTB , half LED is on for 0.5s and the other is off and After 0.5s the LED is complemented

Page 11: Digital i o

Pull-up & Pull-down Resistors

Page 12: Digital i o

Project 3 “Button-1”

LED is connected to RB0 and button to RD0When the button is pressed the LED complement Its Status

Page 13: Digital i o

Project 4 “Button-2”

8 LEDs connected to PORTB and two Switches connected to RA0 and RA1. When Switch1 is pressed the LEDs shiftRight and if Switch2 is pressed the LEDs shift Left

Page 14: Digital i o

Q & A

Page 15: Digital i o

For more information

AZEX Team : FB Page : https://www.facebook.com/AlAZharEXhibition

Mohamed Ali Bedair:FB URL : https://www.facebook.com/MoahmedAliBedairMail : [email protected]