Introduction To Microcontroller: Examples For 8 Bit Microcontrollers
Introduction To Microcontroller: Examples For 8 Bit Microcontrollers
A microcontroller is a small, low-cost computer-on-a-chip which usually includes: An 8 or 16 bit microprocessor (CPU). A small amount of RAM. Programmable ROM and/or flash memory. Parallel and/or serial I/O. Timers and signal generators. Analog to Digital (A/D) and/or Digital to Analog (D/A) conversion. Often used to run dedicated code that controls one or more tasks in the operation of a device or a system. Also called embedded controllers, because the microcontroller and support circuits are often built into, or embedded in, the devices they control. Devices that utilize microcontrollers include car engines, consumer electronics (VCRs, microwaves, cameras, pagers, cell phones ...), computer peripherals (keyboards, printers, modems...), test/measurement equipment (signal generators, multi-meters, oscilloscopes ). Microcontrollers usually must have low-power requirements (~. 05 - 1 W as opposed to ~10 - 50 W for general purpose desktop CPUs) since many devices they control are batteryoperated. Examples for 8 bit Microcontrollers Motorolas 6811 , Intels 8051 ,Zilogs Z8 ,Microchips PIC There are also 16-bit and 32-bit microcontrollers made by various chip makers. The 8051 has 128 bytes of RAM 4K bytes of on-chip ROM Two timers One serial port Four I/O ports, each 8 bits wide 6 interrupt sources The most widely used registers A (Accumulator)-for all arithmetic and logic instructions B, R0, R1, R2, R3, R4, R5, R6, R7 16 bit DPTR (data pointer), and PC (program counter) PSW Program Status Word (8 bit flag register) PSW 7 6 5 4 3 2 1 0
only 6 bits are used, the four are CY (carry), AC (auxiliary carry), P (parity), and OV (overflow) They are called conditional flags, meaning that they indicate some conditions that resulted after an instruction was executed. The PSW3 and PSW4 are designed as RS0 and RS1, and are used to change the register bank. The two unused bits are user-definable