8051 Serial communication - Microcontroller Programming and Embedded Systems

0 comments

Serial Communication is a form of I/O in which the bits of a byte being transferred appear one after other in a timed sequence on a single wire. Serial Communication uses two methods, asynchronous and synchronous. The Synchronous method transfers a block of data at a time, while the asynchronous method transfers a single byte at a time. In Synchronous Communication the data get transferred based on a common clock signal. But in Asynchronous communication, in addition to the data bit, one start bit and one stop bit is added. These start and stop bits are the parity bits to identify the data present between the start and stop bits.






The 8051 has two pins that are used specifically for transferring and receiving data serially. These two pins are called TXD and RXD and are part of the Port-3 group (Port-3.0 and Port-3.1). Pin 11 of the 8051 is assigned to TXD and pin 10 is designated as RXD. These pins are TTL compatible; therefore they require a line driver to make them RS232 compatible. The line driver chip is MAX232. The MAX232 uses +5v power source, which is same as the source voltage for 8051.

8051 Interrupts Programming - Microcontroller Programming and Embedded Systems

0 comments


Interrupt is one of the most important and powerful concepts and features in Microcontroller / processor applications. Almost all the real world and real time systems built around microcontrollers and microprocessors make use of interrupts.
What is Interrupt
The interrupts refer to a notification, communicated to the controller, by a hardware device or software, on receipt of which controller momentarily stops and responds to the interrupt. Whenever an interrupt occurs the controller completes the execution of the current instruction and starts the execution of anInterrupt Service Routine (ISR) or Interrupt Handler. ISR is a piece of code that tells the processor or controller what to do when the interrupt occurs. After the execution of ISR, controller returns back to the instruction it has jumped from (before the interrupt was received). The interrupts can be either hardware interrupts or software interrupts.
Why need interrupts
An application built around microcontrollers generally has the following structure. It takes input from devices like keypad, ADC etc; processes the input using certain algorithm; and generates an output which is either displayed using devices like seven segment, LCD or used further to operate other devices like motors etc. In such designs, controllers interact with the inbuilt devices like timers and other interfaced peripherals like sensors, serial port etc. The programmer needs to monitor their status regularly like whether the sensor is giving output, whether a signal has been received or transmitted, whether timer has finished counting, or if an interfaced device needs service from the controller, and so on. This state of continuous monitoring is known as polling.

In polling, the Microcontroller keeps checking the status of other devices; and while doing so it does no other operation and consumes all its processing time for monitoring. This problem can be addressed by using interrupts. In interrupt method, the controller responds to only when an interruption occurs. Thus in interrupt method, controller is not required to regularly monitor the status (flags, signals etc.) of interfaced and inbuilt devices.

 

Free Download Engineering Books - IEEE Books | Copyright 2009-2013 All right reserved | Design by BMW Automobiles | Created by Umair Sheikh