1. Fill in the blanks
1.
A microcontroller integrates
a microprocessor
, a certain capacity of
RAM
and
ROM
,
I/O
ports, timers and other circuits.
A microcomputer built on a chip.
2.
The microcontroller
80C51
integrates
4
KB
of
FLASH ROM into the chip
and has a total of
5
interrupt sources.
3.
Two-digit hexadecimal numbers can represent up to
256
storage units.
4.
In
80C51
, only when
the EA
pin is connected
to high level
,
the CPU
can access the on-chip
Flash ROM
.
5.
When
the CPU
accesses off-chip memory, the lower eight-bit address is provided by
the P0
port, and the upper eight-bit address is provided by
the P2
port.
8-
bit data is provided by
P0
port.
6.
In
the I/O
port, when
the P0
port is connected to
the LED
, a pull-up resistor must be provided, and
the P3
port has a second function.
7.
80C51
has 64 KB byte addressing capability
.
8.
In
80C51
, the on-chip
RAM is divided into
real RAM area
with addresses
00H~7FH
and special RAM area with addresses 80H~FFH .
There are two parts in the special function register
(SFR)
area.
9.
In
80C51
, the general register area is divided into
4
groups, each group has
8
working registers. When
the CPU
is reset,
Group
0
registers are the current working registers.
10.
The data pointer
DPTR
is a
16
-bit special function
register
.
11.
In
80C51
, one machine cycle includes
12
oscillation cycles, and each instruction consists of one or several machine cycles.
It consists of single-cycle instructions, two-cycle instructions and
4-
cycle instructions.
12.
When the system is in normal working condition and the oscillation is stable,
add a high level to the
RST pin
and maintain
The system can be reset after
2 machine cycles.
13.
After
the microcontroller
80C51 is reset, the value of its
I/O port latch is 0FFH , the value of the stack pointer is 07H , and SBUF
The value
is undefined
, the value of the internal
RAM
is not affected by reset, and the values of the other registers are all
0H
.
14.
In
809C51
, there are two ways to make the microcontroller exit idle mode. One is
to respond to any interrupt request
, and the other is to
The second is
hardware reset
; only
hardware reset
can make the microcontroller that enters power-down mode exit power-down mode.
15.
The five interrupt sources of
the microcontroller
80C51
are INT0 , INT1 , T0 , T1 and TXD/RXD .
16. The interrupt of
the microcontroller
80C51
uses
4
special function registers, which are
TCON
,
SCON
,
IE
and
IP
.
17.
In
80C51
, the external interrupt is controlled by
the IT0(1)
bit in two triggering modes, namely
level triggering
and
edge triggering.
Edge
trigger mode.
18.
The interrupt processing process is divided into
four
stages, namely
interrupt request
,
interrupt response
,
interrupt service
and
interrupt return
.
19. There are two
16 -bit timers / counters in the 80C51
microcontroller
, namely T0 and T1 . They both have timing and counting functions .
function of numbers .
20. The clock frequency of
the microcontroller
80C51
is
6MHz
. If the timing is required to be
1ms
,
the timer
/
counter works in mode
1
, and its timing /counter
The initial value of the counter is
FE0CH
.
21.
The microcontroller
80C51
has
two communication methods:
parallel
communication and
serial communication.
22.
Serial communication has
two communication methods:
synchronous
communication and
asynchronous communication.
23.
In asynchronous communication, the data frame format defines that a character consists of
4
parts, namely:
start bit
,
data bit
,
strange
Even parity bit
and
stop bit.
24.
In serial communication, in order to make the equipment work synchronously, both communicating parties need to have two common requirements. First, both
communicating parties must
Using a unified encoding method
, the second is that
both communicating parties must be able to produce the same transmission rate
.
25. There are
4 modes of serial communication in
the microcontroller
80C51 , among which mode
0 is used as a synchronous shift register to expand
Exhibit
I/O
port.
26.
Assume the crystal oscillator frequency of
80C51
is
11.0592MHz
, select timer
T
working mode
2
as the baud rate generator, and the baud rate is
2400b/s
, and
SMOD
is set to
0
, the initial value of the timer is
F4H
27.
Keyboards can be divided into two types:
independent connection
type and
matrix
type. Keyboards can be divided into
coding
and
non-editing
Two types of codes
28.
LED digital tube has two modes
:
static display and dynamic display.
29.
After executing the following instructions,
A=___60H___
,
R0=__45H____
, (
60H
)
=___45H___
.
MOV A
,
# 45H
MOV R0
,
# 60H
MOV @R0
,
A
XCH A, R0
30.
Assume
(2456H)=66H , (2457H)=34H in
RAM
, (2456H)=55H , (2457H)=64H in ROM . Please analyze
The contents of each register after the above program is executed. (
A
)
=___64H___
, (
DPTR
)
=__2456H____
.
MOV A
,
#1
MOV DPTR
,
#2456H
MOVC A
,
@A+DPTR
31
. For microcontrollers, the output port connected to the data bus should have a
(latch)
function.
32
.
The (
PC
)
register determines the order of program execution
, and the value of this register when reset is
(
0000h
)
.
33.
The three main functional components of the microcomputer included in the microcontroller are
CPU
, memory and
(
I/O
port)
.
34. The word length of 80C51
series microcontroller is
(
8
)
bits, with
(
40
)
pins.
35.The function of the
ALE signal is
(latching allowed)
.
36.After reset of 80C51
,
PC =
(
0000
)
H.
The stack pointer of 37.80C51
is
(
SP
)
.
38
.
In addition to being used as parallel ports for data input/output, the P0 and P2 ports of the
80C51 microcontroller are usually used
Build system's
(address)
and
(data)
.
39
.
The external interrupt request signal of 80C51
microcontroller has level mode and
(edge trigger)
. In level mode, when
INT0
,
When the valid signal of
INT1 is
(low level)
, the external interrupt is activated.
40
.
80C51
microcontroller instruction
ANL A
,
the addressing mode of the source operand in
20H is
(direct) .
41
. There are two basic methods of serial communication
(synchronous)
and asynchronous.
42. The storage type XDATA
in
C51 defines the (external) storage space, and its address range is ( 0000h~ffffH )
43.
After executing the following procedures, (
A
)
=__35H____
, (
B
)
=__16H____
.
MOV A
,
#9FH
MOV B
,
#36H
ANL B
,
A
SETB C
ADDC A
,
B
2. Multiple choice questions
1.
80C51 is a product of which of the following companies
?
(C)
A
、
INTEL B
、
AMD C
、
ATMEL D
、
PHILIPS
2.
The
80C51
series microcontroller belongs to the (C) architecture.
A.
Von Neumann
B.
Princeton
C.
Harvard
D.
Turing
3.
Which of the following instructions is written incorrectly (C).
A
、
MOV DPTR,#3F98H B
、
MOV R0,#0FEH C
、
MOV 50H,#0FC3DH D
、
INC R0
4.
Which of the following instructions is written incorrectly (D).
A
、
INC DPTR B
、
MOV R0,#0FEH C
、
DEC A D
、
PUSH A
5.
Which of the following instructions is written incorrectly (B).
A
、
MOVC A,@A+DPTR B
、
MOV R0,#FEH C
、
CPL A D
、
PUSH ACC
6.
Which of the following is a bit operation instruction (B).
A
、
MOV P0
,
#0FFH B
、
CLR P1.0 C
、
CPL A D
、
POP PSW
7.
Which of the following is a bit operation instruction (B).
A
、
MOV P1
,
#0FFH B
、
MOV C,ACC.1 C
、
CPL A D
、
POP PSW
8.
Which of the following is a bit operation instruction (B).
A
、
MOV P0
,
#0FFH B
、
SETB TR0 C
、
CPL R0 D
、
PUSH PSW
9.
Which of the following interface buses has the least number of interface buses? (C)
A.
SPI B. I2C C. Single bus
D.
Parallel communication
10.
Which of the following is a device that belongs to the forward channel of the microcontroller system? (A)
A
,
A/D
conversion
B
,
D/A
conversion
C
,
LED
digital tube
D
, relay
11. When
RS1 and RS0 of 80C51 microcontroller =01 , the current registers R0-R7 occupy the internal RAM
(
B) unit.
A
、
00H—07H B
、
08H—0FH C
、
10H—17H D
、
18H—1FH
12. The
80C51 microcontroller has on-chip RAM
capacity
( A) .
A. 128B B
、
4KB C
、
8KB D
、
256B
13.
The maximum timing unit of the 80C51
microcontroller is
(D) .
A.
Beat
B.
State
C.
Machine cycle
D.
Instruction cycle
14.
The timer / counter working mode 0 of the 80C51
microcontroller
is (C).
A.
8 - bit counter structure B. 16 - bit counter structure C. 13 -bit counter structure D. 2 8 -
bit
counter structures
15.
The external interrupt 0 interrupt entry address of the 80C51
microcontroller is
(C) .
A
、
000BH
B
、
001BH
C
、
0003H D
、
0013H
16.
Among the following instructions of the
80C5l
microcontroller, the error is (
A
).
A
.
MOVC @A+DPTR
,
A B
.
MOV A, @R0 C
.
MOV 20H, A D
.
MOV B, A
17.
After the microcontroller is powered on and reset, the maximum allowable range of the stack area is
(
B
) units.
A
.
64 B
.
120 C
.
128 D
.
256
18. The ALE pin of 80C51
microcontroller
is (C).
A.
_ Output high
level
B.
Output low
level
C.
Outputs a rectangular pulse with a frequency of
1/6 of
fosc
D.
_ Output rectangular pulse, frequency is
1/2 of
fosc
19
.
The XTAL1 and XTAL2 pins of the
80C51 microcontroller
are ( D ) pins.
A.
External timer
B.
External serial port
C.
External interrupt
D.
External crystal oscillator
The serial data buffer
SBUF of
20.80C51
is used for (
D
).
A.
_ Store the intermediate results of
operations
B.
Temporarily store data
and address
C.
Store programs to be debugged
D.
_ Store data to be sent or received
21. Assume that
the value of
the stack pointer
SP is set to
37H . After the breakpoint address is pushed into the stack for protection when calling a subroutine, the value of SP is
D
)。
A
.
6H B
.
37H C
.
38H D
.
39H
22. The program counter
PC
in the microcontroller
is used ( B ).
A.
_ Store
instruction
B.
Store the address of the instruction being executed
C.
_ Store the next instruction
address
D.
Store the address of the previous instruction
23.
In the
80C51
instructions, (
C
) among the following instructions is an unconditional transfer instruction.
A
.
LCALL addr16 B
.
DJNZ direct,rel C
.
SJMP rel D
.
ACALL addr11
24
.
The interrupt system of the 80C51
series microcontroller has (
A
).
A
,
5
interrupt sources
B
,
6
interrupt sources
C
,
2
interrupt sources
D
,
3
interrupt sources
25
.Instructions and programs are
stored in program memory in (
C ) form.
A.
Source
program
B.
Assembly program
C.
Binary code
D.
BCD code
26
.When it is necessary to fetch data from
the 80C51
microcontroller program memory, the instruction used is (
B
)
A
、
MOV A, @R1 B
、
MOVC A, @A + DPTR
C
、
MOVX A, @ R0 D
、
MOVX A, @ DPTR
3. Judgment
1.
In the instruction system of the
51
series microcontroller, addition, subtraction, multiplication and division must be
completed with the participation of accumulator
A.
T
2.
When
the EA pin of
80C51
is connected to low level, the CPU can only access the off-chip ROM , regardless of whether there is program memory on the chip. T
3.
When
the EA pin of
80C51
is connected to high level, the CPU can only access the 4KB space on the chip . F
4. The result of directly reading the port and reading the port latch
of
the 80C51
series microcontroller is always the same.
F
5.
Whether to read the port or read the latch is distinguished by instructions.
T
6.
In the
on-chip RAM area of
80C51
, the bit address conflicts with some byte addresses. F
7.
The vector address of the interrupt is located in
the RAM
area.
F
8.
In
80C51
, when
the CPU
accesses the on-chip and external
ROM
areas, it uses
the MOVC
instruction, and when it accesses the off-chip
RAM
area, it uses
the MOVX
instruction.
Use the MOV instruction when accessing the on-chip
RAM area
. T
9.
The working register area is not allowed to be used as an ordinary
RAM
unit.
F
10. The working register group is
switched
by setting
RS0 and RS1 in
PSW .
T
11.
Special function registers can be used as ordinary
RAM
units.
F
12.
To access
the 128
-bit address, use bit addressing mode, and to access the lower
128
-byte unit, use direct or indirect addressing mode.
T
13. The content of
the stack pointer
SP can point to
any RAM unit from 00H to 7FH
on the chip . After the system is reset,
SP is initialized to 00H . F
14.
DPTR can only be used as a 16 -bit special function register
.
F
15.
The program counter
PC
is an addressable special function register.
F
16.
After
the microcontroller
80C51 is reset, its
PC pointer is initialized to 0000H , allowing the microcontroller to start executing the program from this address unit. T
17.
After the microcontroller system is powered on, the value of its internal
RAM
is uncertain.
T
18.
In
80C51
, when an interrupt response occurs, all interrupt request flags are automatically cleared by hardware.
F
19.
In
the 51
series microcontroller, the interrupt service routine starts from the vector address and continues until the return instruction
RETI
.
T
20.
When executing a subroutine call or executing an interrupt service routine, a stack push action will occur.
T
21.
When
the timer
/ counter works in the timing mode, it
counts the pulses output by the 80C51 on-chip oscillator divided by 12 until
until overflow.
T
22.
When
the timer
/ counter works in counting mode, it
counts external pulses through P3.4 and P3.5 of 809C51 . When a pulse is encountered,
Count once on falling edge.
T
23.
The timer
/
counter consumes
CPU
time when working.
F
24.
The timer
/
counter operating mode register
TMOD
can be bit addressed.
F
25.
Before
the timer
/ counter is used and after overflow, an initial value must be assigned to it to work properly.
F
26.
Among the instructions of
the 51
series microcontroller, there are both subtraction instructions with borrow and subtraction instructions without borrow.
F
27. Whether
the timer / counter of
the microcontroller
80C51
works can be controlled through external interrupts. T
28.
The advantage of parallel communication is high transmission speed, but the disadvantage is that it requires more transmission lines and makes long-distance communication inconvenient.
T
29.
The advantage of serial communication is that it only requires a pair of transmission lines, is low in cost, and is suitable for long-distance communication. The disadvantage is that the transmission speed is low.
T
30.
In asynchronous communication, keep the high level when no characters are transmitted on the line.
T
31.
In the frame format of asynchronous communication, the data bits are arranged with the low bit first and the high bit last.
T
32.
In asynchronous communication, the baud rate refers to the number of bits of binary code transmitted per second, and the unit is
b/s
.
T
33.
In the serial communication of
80C51 , the sending and receiving of the serial port are
realized by reading / writing
the special function register
SBUF .
T
34.
In the microcontroller
809C51
, the baud rate of serial communication mode
1
and mode
3
is fixed.
F
35.
In the microcontroller
809C51
, the read and write
SBUFs
are physically independent, but the addresses are the same.
T
36.
The single-chip computer
80C51
generally uses a non-integer crystal oscillator in order to obtain an accurate baud rate.
T
37. In the communication between
the microcontroller
809C51
and
the PC
, the chip
MAX232
is used for level conversion.
T
38.
In the
A/D
converter, the successive approximation type is inferior to the double integral type in accuracy, but the double integral type is lower in speed.
T
39. The accuracy of
A/D conversion not only depends on the number of quantization bits, but also depends on the reference voltage
.
T
4. Short answer questions
1.
Briefly describe the concept of
80C51
microcontroller interrupt.
Answer: When the CPU is processing something, an external event requires the CPU to process it quickly. Therefore, the CPU temporarilyWhen the current work is suspended, go to the processing time. After the interrupt service handles the event, it returns to the place where it was originally interrupted.Then continue the original work. This process is called interruption.
2.
What is a protected site and what is a restored site?
Answer: Protect the scene: When the CPU responds to the interrupt program, the hardware will automatically push the breakpoint address ( the value of the 16 -bit program counter)In addition to the stack, users must also pay attention to protecting information about working registers, accumulators, flag bits, etc.;Restoring the scene: After completing the interrupt service routine, restore the contents of the original working registers, accumulators, flag bits, etc.
3. What are the interrupt sources
of the microcontroller
80C51
, and how to control its interrupt requests?
Answer: The 80C51 interrupt system has 5 interrupt sources:●INT0 : External interrupt 0 request, active at low level. Input via P3.2 pin.●INT1 : External interrupt 1 request, active at low level. Input via P3.3 pin.●T0 : Timer / counter 0 overflow interrupt request.●T1 : Timer / counter 1 overflow interrupt request.●TXD/RXD : Serial port interrupt request. When the serial port completes sending or receiving a frame of data, it requests an interrupt.
4. Briefly describe
the natural priority order of
microcontroller
809C51 interrupts and how to improve the priority level of a certain interrupt source.
Answer: Interrupt source (control bit) natural priorityExternal Interrupt 0 ( PX0 ) HighestTimer / Counter0 overflow interrupt ( PT0 )External Interrupt 1 ( PX1 )Timer / Counter 1 overflow interrupt ( PT1 )Serial port interrupt ( PS ) minimumIf some control bits are 1 , the corresponding interrupt source is specified as a high-level interrupt; conversely, if some control bits are 0 , the corresponding interrupt sourceThe interrupt source is specified as a low-level interrupt. When several interrupt requests of the same priority level are received at the same time, which interrupt source is responded to depends onBased on the internal hardware query order (i.e. natural priority).
5.
Briefly describe the conditions for interrupt response of the
51
series microcontroller.
Answer: ● An interrupt source issues an interrupt request;● Interrupt total enable bit EA=1 , that is, the CPU enables interrupts;● The interrupt enable bit of the interrupt source requesting an interrupt is 1 , that is, the interrupt is not masked;● No interrupt of the same level or higher is being serviced;● The current instruction cycle has ended;
6.
Briefly describe the characteristics of mode
0 , 1 , and 2 among the four working modes of timer
/
counter
.
Answer: Mode 0 : It is a 13 -bit timer / counter. The register TLx stores the lower 5 bits and the THx stores the upper 8 bits.Mode 1 : It is a 16 -bit timer / counter;Method 2 : Configure TL0 (or TL1 ) as an 8 -bit timer / counter that can automatically reload ;
7.
Briefly describe
the four methods and characteristics of
80C51 serial communication.
Mode 0 : Synchronous shift register input / output mode, often used for expansion I/O ports. The baud rate is fixed at 1/12 of the oscillation frequency ,It is not affected by the SMOD bit in the PCON register .Mode 1 : used for serial transmission or reception, 10 -bit universal asynchronous interface. TXD and RXD are used to send and receive data respectively.The format of sending and receiving one frame of data is 1 start bit, 8 data bits (low-order bit first), and 1 stop bit, a total of 10 bits. The baud rate is determined byThe overflow rate of timer T1 is determined simultaneously with the SMOD value.Mode 2 : used for serial transmission or reception, 11 -bit universal asynchronous interface. TXD and RXD are used to send and receive data respectively.The format of sending and receiving one frame of data is 1 start bit, 8 data bits (low-order bit first), 1 programmable 9th data bit and 1 stop bit, a total of 11 bits. The baud rate depends on the value of the SMOD bit in PCON : when SMOD = 0 , the baud rate is 1/64 ; when SMOD = 1 , the baud rate is 1/32 .Mode 3 : used for serial transmission or reception, 11 -bit universal asynchronous interface. TXD and RXD are used to send and receive data respectively. The frame format is the same as mode 2 , and the baud rate is the same as mode 1 .
8.
Briefly describe why debounce processing is needed and how to handle it when using ordinary buttons.
Key jitter can cause a single key press to be misread multiple times. In order to ensure that the CPU only processes a key closure once, key jitter must be removed.When the key is closed and stabilized, the status of the key is read and must be judged; after the key is released and stabilized, processing is performed. Key jitter, availableThere are two ways to eliminate it, hardware or software.
9.
Briefly describe
the principle and implementation of dynamic scanning of
LED digital tubes.
The principle of dynamic scanning is to use the persistence of human vision to make people feel that all LEDs are lit at the same time. Light up each LED in turn, bit by bit ,Each bit is maintained for 1ms , and lights up again within 10 to 20ms . Repeatedly, dynamic scanning can be achieved.
5. Programming questions
1.
Use
the P1
port to control
the LED
monochromatic light to realize the running water lamp display. The monochromatic light is
0
on
and 1
off. The crystal oscillator is known to be
12MHz
.
2.
Use
the P0
port to control
the LED
monochromatic light to realize the revolving door display. The monochromatic light is
0
on
and 1
off. The crystal oscillator is known to be
12MHz
.
3.
Display of
digital tube
0~9 .
4.
Use a timer
/
counter plus a software counter to realize a one-second clock reference signal. Try writing the program and explaining it.
(Suppose the crystal oscillator frequency is
12MHz
, and the second signal is output from the
P1.0
port.)
#include<reg51.h>
sbit P10 = P1^0;
unsigned char k;
void main()
{
TMOD = 0x01;
TL0 = 0xb0;
TH0 = 0x3c;
TR0 = 1;
ET0 = 1;
EA = 1;
P10 = 1;
while(1);
}
void t0_isr() interrupt 1
{
TL0 = 0xb0;
TH0 = 0x3c;
k++;
if(k==20)
{
k=0;
P10 = ~P10;
}