3. What is a Microcontroller
(MCU)
• It is a single chip microprocessor system
which contains data and program memory,
serial and parallel I/O ports, timers, external
and internal interrupts, ALL integrated into a
single chip.
5. Central Processing Unit
• this could refer to the actual processor part of a
microcontroller, the microprocessor within a
computer, or the processor "box" of a computer
system.
Microprocessor Unit
• This devices tend to be aimed at computer
applications.
Microcontroller Unit
• This devices tend to be aimed at embedded control
applications
• They tend to consist of a processor plus a number of
useful peripherals (MMU, Timers, watchdog, A/D, etc,
etc, etc).
10. What you need to know!
• Before you can make a working microcontroller
project, you should first know the following:
1. Supply Voltage
2. Number of I/O
3. Special Purpose I/O(Serial Ports, ADC Ports, etc)
4. Memory(RAM and ROM)
5. Timers/Counters
6. Interrupts
7. XTAL Oscillator frequency
12. Supply(VCC,GND)- 2.7V to 6V Operating Range
Pin I/0pins:
o Port 1 - The Port 1 is an 8-bit bi-directional I/O port. The
Configuration Port 1 out-put buffers can sink 20 mA and can drive LED
displays directly.
o Port 3 - Port 3 pins P3.0 to P3.5, P3.7 are seven bi-
directional I/O pins with internal pull-ups.
Special Purpose I/O
o P3.0 RXD (serial input port)
o P3.1 TXD (serial output port)
o P3.2 INT0 (external interrupt 0)
o P3.3 INT1 (external interrupt 1)
o P3.4 T0 (timer 0 external input)
o P3.5 T1 (timer 1 external input)
Memory(2Kbytes)
Timers/Counters - 2 16-bit timer/counter
Interrupts(6 sources of interrupts)
o Reset, Timer 0 overflow, Timer 1 overflow,
External Interrupt 0, External Interrupt 1, Serial
Port events (buffer full, buffer empty, etc)
XTAL frequency - 0 Hz to 24 MHz
14. Microcontroller Programming
• Traditionally, it can only be programmed using
assembly language.
• But due to the complexity of assembly
language, high level language were developed
such as BASIC and C Programming
17. Sample Programs
#include<AT892051.h>
/*Function to delay about a second
void wait_a_sec()
{
Unsigned int x;
for(x=0;x<33000;x++);
}
/*start of main program*/
main()
{
int LED = 1;
for(;;)
{
P1=~LED;
LED++;
wait_a_sec();
}
}
18. Oops! First we
configure!
• Select
Project – Components,
Environment, Books