Download presentation
Presentation is loading. Please wait.
Published byErica Barker Modified over 8 years ago
2
Mini-Computer ◦ Microprocessor The Brains Arithmetic Logic Unit (ALU) Control Unit Program/ Data Storage Peripherals (Input/Output) Low-Cost
3
Embedded Inside: ◦ Automotive systems ◦ Airplanes ◦ Toys ◦ Medical Devices ◦ Furniture ◦ Billions of units
4
AT89C51AT89C52AT89S51AT89S52 ATMEGA-8 AT89C2051 AT89C4051 AT89C55WD AT89S8252 AT90S2313 AT90S8515 AT90S8535 ATMEGA-16 ATMEGA-32 ATMEGA-64 ATMEGA-88 ATTINY-13 ATTINY-15 ATTINY-26 AT89C51ED2 AT89C51RD2AT91RM9200 AT91SAM256 ATMEGA-128 ATMEGA-162W78E052B40DL
5
PIC16F72 PIC16F73 PIC16F74 PIC16F76 PIC16F77 PIC16F88 PIC10F200 PIC12F508 PIC12F629 PIC12F675 PIC16C54C PIC16C57C PIC16C65B PIC16C923 PIC16F676 PIC16F84A PIC18F452 PIC16C622A PIC16F628A PIC16F648A PIC16F873A PIC16F876A PIC16F877A PIC18F2550 PIC18F4550
6
Wide operating voltage range (2.0V-5.5V) 33 I/O pins Two 8-bit Timer, One 16-bit Timer 8-channel, 10-bit ADC Programmable Serial USART Internal Calibrated RC Oscillator DC – 20 MHz oscillator/clock input Software selectable frequency range of 8 MHz to 32 kHz 40-Pin Pin Enhanced Flash, 8-Bit CMOS Microcontrollers with Nano Watt Technology
8
To start C programming language on Microchip PIC Microcontroller you need these following tools: Down load the latest MikroC and Install it The PIC16F877A datasheet Microchip Programmer. Trainer Board
9
For Port A, B, C, D, E there are control bytes TRISx. Setting a TRISx bit (= 1) will make the corresponding PORTx pin an input Clearing a TRISx bit (= 0) will make the corresponding PORTx pin an output
15
#include void main() // main function { TRISA0 = 1; // declare RA0 pin as input TRISC = 0; // declare POART C as output ADCON1=0b00000110;//declare RA0 pin as digital while (1) // working loop { if(PORTA == 0) { PORTC = 0; } else if (PORTA0 == 1) { PORTC = 1; }
20
Ensure that the output current <20mA Maximum output current sunk by any I/O pin.................................................................................................... 25 mA Maximum output current sourced by any I/O pin.............................................................................................. 25 mA Maximum current sunk by PORTA, PORTB and PORTC (combined)............................................................ 200 mA Maximum current sourced PORTA, PORTB and PORTC (combined)............................................................ 200 mA
22
For hardware side, use 1uf-10uf Capacitor across the push button if the input source is a push button. Solve the de-bouncing problem by programming accordingly.
23
Write a program that ◦ takes input from RC0 and RC1 ◦ Output LED at RC2 is light while any of the input is high ◦ Output LED as RC3 is light while both of the inputs are high Simulate it and run it to the Microcontroller
24
◦ TRISC0=1; // defined as input ◦ TRISC1=1; // defined as input ◦ TRISC2=0; // defined as output ◦ TRISC3=0; // defined as output While(1){ RC2=RC0 | RC1; RC3= RC0 &RC1; }
25
10-bit Resolution 13 - 260 μs Conversion Time 8 Multiplexed Single Ended Input Channels 0 - VCC ADC Input Voltage Range Selectable 2.56V ADC Reference Voltage
26
10-bit Resolution
27
8 Multiplexed Single Ended Input Channels
28
0 - VCC ADC Input Voltage Range
29
Selectable 2.56V ADC Reference Voltage
34
Enable ADC Analog input channel declaration Channel Selection Clock Selection Start a conversion Wait until the conversion finishes When the conversion is done, read the 8 bit LSB from ADRESL and 2 bit MSB from ADRESH byte. Concatenate them to get 10 bit conversion
35
There are the registers available to control the functionality of the A/D module: 1. ADON=1 2. ADCS2,1,0 3. CHS2,1,0
37
Set the corresponding TRISx bits to ‘1’ to set the pin output driver to its high-impedance state. Likewise, set the corresponding ANSx bit to disable the digital input buffer.
40
The A/D conversion can be supplied in two formats: Left or right justified. The ADFM bit (ADCON0 ) controls the output format.
41
There are two options for the voltage reference to the A/D converter: either VDD is used or an analog voltage applied to VREF is used. The VCFG bit (ADCON0 )controls the voltage reference selection. If VCFG is set, then the voltage on the VREF pin is the reference;otherwise, VDD is the reference.
43
The source of the conversion clock is software selectable via the ADCS bits (ADCON1 ).
44
The A/D conversion is initiated by setting the GO/DONE bit (ADCON0 ). When the conversion is complete, the A/D module: Clears the GO/DONE bit
47
Special Thanks to Md. Ariful Haque
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.