Professional Documents
Culture Documents
Microcontrollers
By
Md. Ariful Hoque Shuhan
mdshuhan@yahoo.com
Mobile: 01678142459
&
Abdur Rahman Noble
arnoble072@gmail.com
Mobile:01670225958
What is a Microcontroller?
Mini-Computer
Microprocessor
The Brains
Arithmetic Logic Unit (ALU)
Control Unit
Program/
Data Storage
Peripherals (Input/Output)
Low-Cost
History
The
Why Important?
Embedded
Inside:
Automotive systems
Airplanes
Toys
Medical Devices
Furniture
Billions
of units
Available uC in
Bangladesh
AT89C51
AT89C52
AT89S51
AT89S52 ATMEGA-8
AT89C2051 AT89C4051 AT89C55WD
AT89S8252 AT90S2313 AT90S8515
AT90S8535 ATMEGA-16
ATMEGA-32 ATMEGA-64 ATMEGA-88
ATTINY-13
ATTINY-15 ATTINY-26 AT89C51ED2
AT89C51RD2 AT91RM9200
AT91SAM256 ATMEGA-128 ATMEGA162
W78E052B40DL
Available uC in
Bangladesh
PIC16F72
PIC16F74
PIC16F77
PIC10F200
PIC12F629
PIC16C54C
PIC16C65B
PIC16F676
PIC18F452
PIC16F628A
PIC16F873A
PIC16F877A
PIC18F4550
PIC16F73
PIC16F76
PIC16F88
PIC12F508
PIC12F675
PIC16C57C
PIC16C923
PIC16F84A
PIC16C622A
PIC16F648A
PIC16F876A
PIC18F2550
PIC16F690
20-Pin Flash-Based, 8-Bit
CMOS Microcontrollers with
nanoWatt Technology
Wide
Pin
Diagram
Software Installation
1.
2.
3.
MPLab
Programmer
Software
Proteus
Open MPLAB
END OF CLASS -1
I/O Port
For
#include<htc.h>
void delay(int x)
{
int y;
for(y=0;y<=6500;y++)
{
}
}
void main()
{
TRISC=0X00;
TRISA0=0;
TRISB=0X00;
while(1)
{
PORTC=1;
RA0=1;
PORTB=1;
delay(800);
PORTC=0;
RA0=0;
PORTB=255;
delay(800);
}
}
Input
Input Arrangement
For
Class work
Write
a program that
to 7-segment Decoder
LCD Driver
5X7 Dot Matrix Driver
END OF CLASS 3
Analog to Digital
Converter
10-bit
Resolution
13 - 260 s Conversion Time
12 Multiplexed Single Ended
Input Channels
0 - VCC ADC Input Voltage
Range
Selectable 2.56V ADC
Reference Voltage
Block Diagram
Related Pins
Configuration Sequence
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
Configuration Bytes
There are four registers available
to control the
functionality of the A/D module:
1. ANSEL
2. ANSELH
3. ADCON0
4. ADCON1
Enabling ADC
CHANNEL SELECTION
There
VOLTAGE REFERENCE
There
Voltage Reference
CONVERSION CLOCK
The
STARTING A CONVERSION
The
CONVERSION OUTPUT
The
END OF CLASS 4
Interrupt
Basics
of Interrupt
Interrupt Basic
So far functions were called from the main
program or other functions. The interrupt
functions is called by the hardware itself and
operates by following steps:
After the interrupt function is loaded into the
memory, the function waits for a moment for
the interrupt to occur;
When the interrupt has occurred, the
operating system stops the execution of the
main function and free itself to perform the
interrupt function;
After the execution of the interrupt function,
the operating system continues to run the
main function from the place it stopped
before the interrupt has occurred.
Interrupt Pins
Interrupts
Interrupt Configuration
RA2/INT
TRISA2=1
ANS2=0 for digital input
Mode Selection
INTERRUPT
External interrupt on
RA2/INT pin is edge-triggered;
either rising if the INTEDG bit
(OPTION_REG<6>) is set,
or falling, if the INTEDG bit is clear.
So
END OF CLASS 5
Timer/ Counter
3
timers/Counters
Two 8-bit timers and One 16-bit
timer
Easily selectable clock source
Its
Timer0 Diagram
Timer Configuration
Clock
selection
Mode Selection
Interrupt configuration
external
clock source
must be at least
2.5 less than the
C clock source.
Clock Source
The
Timer Interrupt
Configuration
Timer1
END OF CLASS 6
USART
Clock Generation
PORT Configuration
In
To set up an Asynchronous
Transmission:
1.
Transmission
Receiver Enabling
RCIF.
END OF CLASS 7
6 February 2010
CLASS 8
Analog Comparator
Comparator Enabling
Negative Channel
Selection
Comparator Output
The
END OF CLASS 8