单片机实验6.5

① P1.0, 10HZ方波

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
ORG 0000H
AJMP MAIN
ORG 000BH
AJMP T0
ORG 0100H
MAIN:
MOV TMOD,#01
MOV TH0,#3CH
MOV TL0,#0B0H
SETB ET0
SETB TR0
SETB EA
SJMP $
T0:
MOV TH0,#3CH
MOV TL0,#0B0H
CPL P1.0
RETI
END

②P1.0, 周期100ms, 占空比40%

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
RG 0000H
AJMP MAIN
ORG 000BH
AJMP T0
ORG 0100H
MAIN:
MOV SP,#60H
MOV TMOD,#01
SETB P1.0
MOV TH0,#63H
MOV TL0,#0C0H
SETB ET0
SETB TR0
SETB EA
CLR P1.0
MOV R0,#0
SJMP $
T0:
INC R0
CJNE R0,#1,HIGH
MOV TH0,#15H
MOV TL0,#0A0H
SETB P1.0
MOV R0,#0
JMP EXIT
HIGH:
INC R0
MOV TH0,#63H
MOV TL0,#0C0H
CLR P1.0
EXIT:
RETI

请我喝杯咖啡吧~

支付宝
微信