Real World Interfacing Notes
Contrast and compare interrupts versus polling.
A single microcontroller can serve several devices. There are two ways to do that is interrupts or polling. In the interrupt method, whenever any device needs its services, the device notifies the micro controller interrupts whatever it is doing and serves the device. The program which is associated with the interrupt is called the interrupt service routine (ISR) or Interrupt handler. In polling, the microcontrollers continuously monitor the status of several devices and serve each of them as certain conditions are met. The advantage of interrupts is that microcontroller can serve many devices. Each device can get the attention of microcontroller based on the priority assigned to it. For the polling method; it is not possible to assign priority. In interrupt method the microcontroller can also ignore (mask) a device request for service. This is not possible in polling method. The polling method wastes much of microcontrollers’ time by polling devices that do not need service, so interrupts are preferred.
Besides reset, how many interrupt do we have in 8051?
5 interrupts are used in 8051. Two interrupts are set aside for timers: One for timer 0 and one for timer 1. Two interrupts are set aside for hardware external hardware interrupts which is called EXI and EX2. Serial communication has a single interrupt that belongs to both receive and transfer
Enable EXO and timer 0 interrupt?
MOV IE, # 10000011 B
Contents of register IE upon reset & what to do these contents mean?
All 0’s means that all interrupts are masked and as a result no interrupts will be respond to\by 8051.
Assume that timer 1 is programmed in mode 2, TH1 = F5H and IE bit for timer 1 is enabled. Explain how the interrupt for timer works?
After timer 1 is started with instruction “SET B TR1” the timer will count up from F5H to FFH on its own while 8051 is executing other tasks Upon rolling over from FFH to 00, the TF1 flag is raised which will interrupt the 8051 in whatever it is doing & force it to jump to memory location OO1BH to execute 1SR belonging to this interrupt.
Which bit of 1E belongs to external hardware interrupts ? Show how both are enabled.
Bits DO and D2 and “MOV TE, # 10000101 B” will enable both of external hardware interrupts.
Explain the role of that each of two bits TCON.0 and TCON.2 play in the execution of external interrupt 0.
TCON.0 is set to high to make INTO an edge-triggered interrupt. If INTO is edge triggered when ever high to low pulse is applied to INTO pin it is captured & kept by TCON.2 bit by making TCON.2 high. While the ISR for INTO is being serviced. TCON. 2 stays high no matter how many times a H to L pulse is applied to pin INTO. Upon the execution of last instruction of ISR, which is RET1, TCON 2 bit is cleared indicating that INTO pin can respond to another interrupt
Why do we need the Interface circuit for applications of Microcontroller?
In 8051 TL is compatible. When its need to interface with Input/output device R 232 use interface circuit MAX 232.
Which bits in which registers must be set to give the serial data interrupt the highest priority?
ES bit of I register i.e. D4.