Beruflich Dokumente
Kultur Dokumente
Overview
Introduction to Microcontrollers Hardware Configuration Microcontroller Programming
this could refer to the actual processor part of a microcontroller, the microprocessor within a computer, or the processor "box" of a computer system. This devices tend to be aimed at computer applications.
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).
ALU
Control Unit
ARE WE CLEAR?
Microcontroller Architecture
EEPROM
RAM
ROM
Other Peripherals
Microprocessor
Analog I/O
Digital I/O
Microcontroller Architecture
Pin Configuration
P3.0 RXD (serial input port) P3.1 TXD (serial output port) P3.2 INT0 (external interrupt 0) P3.3 INT1 (external interrupt 1) P3.4 T0 (timer 0 external input) P3.5 T1 (timer 1 external input)
Reset, Timer 0 overflow, Timer 1 overflow, External Interrupt 0, External Interrupt 1, Serial Port events (buffer full, buffer empty, etc)
Hardware Configuration
RS232
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
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(); }
Configuration
Set the following parameters
Interrupt Subroutines
1. Interrupt subroutine for timer 1 Void timer1() interrupt 3 { Interrupt service code goes here } 2. Interrupt subroutine for timer 3 Void timer0() interrupt 1 { Interrupt service code goes here }
Interrupt Sources