Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Interrupts
51
INTERRUPTS
58
8051 Interrupt related Registers
• The various registers associated with the use of
interrupts are:
– TCON - Edge and Type bits for External Interrupts 0/1
--
• EA : Global enable/disable.
• --- : Reserved for additional interrupt hardware.
63
Interrupt Priority
• We can alter the sequence of interrupt priority by assigning a higher
priority to any one of the interrupts by programming a register
called IP (interrupt priority).
• To give a higher priority to any of the interrupts, we make the
corresponding bit in the IP register high.
• IP is a bit addressable register
64
Interrupt Priority (IP) Register
Serial Port
INT 0 Pin
Timer 1 Pin
70
• Otherwise, there is no connection between rows and
columns
• ‰
In IBM PC keyboards, a single microcontroller takes care of
hardware and software interfacing
• A 4x4 matrix connected to two ports
• The rows are connected to an input port and the columns
are connected to an output port
• Row lines --------lower bits of port 1
• Column lines --------upper bits of port 1
72
Generating square wave
MOV A, #FFH; make port 1 as input port
REP:MOV P1,A;
ACALL DELAY ;
MOV A,#00H;
MOV P1,A;
ACALL DELAY;
SJMP REP;
DELAY: MOV R0, #FFH;
BACK:DJNZ R0,BACK;
RET;
Generating triangular wave
MOV A,#00H;
REP: MOV P1,A;
INC A;
CJNZEA, #FFH,REP;
REP1:MOV P1,A;
DEC A;
CJNE A,#00H,REP1;
SJMP REP;
ADC INTERFACING
Steps for programming ADC
1. Select an analog channel by providing bits to
A,B,C address.
2. Activate the ALE. It needs a L to H pulse to
latch in the address
3. Activate SC by an L to H pulse to initiate
conversion
4. Monitor EOC to see whether conversion is
finished.
5. Activate OE to read data out of the ADC
• P2.0 ------A
• P2.1-------B
• P2.3-------C
• ALE BIT P2.4
• OE BIT P2.5
• SOC BIT P2.6 HERE: JNB EOC HERE;
• EOC BIT P2.7 SETB OE;
– MOV A,P1;