Hot51 enhanced MCU development board schematic diagram

Publisher:博雅之士Latest update time:2021-02-23 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Feature Request:

1): The green light has a 25s countdown. There is a 5s yellow light time when the green light transitions to the red light. The red light will directly turn green after 25s.

2): Press the button to simulate the red light running input, and generate a 5s buzzer beep.


Development Environment:

Software: Keil uVision4

Hardware: HOT51 enhanced MCU development board


code:


ORG 0000H

AJMP MAIN

ORG 0003H

LJMP INTER

ORG 000BH

LJMP TIMER1

ORG 0030H


; Main function starts


MAIN: MOV R7,#00H

DJNZ R7,$

MOV SP,#60H

MOV TMOD,#01H

MOV TH0,#3CH; The timer timing is 50ms

MOV TL0,#0AFH

MOV R6,#20; Timer count 20*50ms=1s

SETB ET0

SETB EX0

SETB OF

SETB TR0



;--------------------------------------------------------------;


ST1: MOV R5,#25; The main road lights up green for 25 seconds, and the branch road lights up red for 25 seconds

DIS1: MOV A,R5

JNZ NEXT1; if 5s has been reduced to 0, jump to the next state ST3

AJMP ST2

NEXT1: MOV A,#25

CLR C

SUBB A, R5 ; Subtract to get the time that has passed

MOV B,A

MOV A,#07H ; Get the jump offset from the table

I have AB

MOV DPTR,#TAB1

ADD A,DPL ; add offset

MOV DPL,A

MOV A,#00H

ADDC A, VAT

IOV VAT, A

MOV A, R4

JZ NOSP1 ; If the chirping time is not 0, chirp (negate p1.2), otherwise do not chirp

CPL P1.2

NOSP1: MOV A,#00H; Dynamic display, cycle lighting of digital tubes

MOV P0,#00H

MOV P2,#0FFH

MOVC A,@A+DPTR

MOV P0,A ; Display the unit digit of the branch

INC DPTR

MOV A,#00H

MOV P0,#00H

MOV P2, #0F6H

MOVC A,@A+DPTR

MOV P0,A ; Display branch tens digit

INC DPTR

MOV A,#00H

MOV P0,#00H

MOV P2,#0F5H

MOVC A,@A+DPTR

MOV P0,A ; Display the main line unit

INC DPTR

MOV A,#00H

MOV P0,#00H

MOV P2, #0F4H

MOVC A,@A+DPTR

MOV P0,A ; Display the main road tens

INC DPTR

MOV A,#00H

MOV P0,#00H

MOV P2,#0F2H

MOVC A,@A+DPTR

MOV P0,A; The following 3 outputs show the main branch lighting status

INC DPTR

MOV A,#00H

MOV P0,#00H

MOV P2,#0F1H

MOVC A,@A+DPTR

MOV P0,A

INC DPTR

MOV A,#00H

MOV P0,#00H

MOV P2,#0F0H

MOVC A,@A+DPTR

MOV P0,A

MOV P0,#00H

MOV P2,#0FFH

AJMP DIS1 ; Return to the start cycle and light up the digital tube


TAB1: DB 3FH,4FH,6DH,5BH,08H,00H,01H ;25

DB 6FH,5BH,66H,5BH,08H,00H,01H ;24

DB 7FH,5BH,4FH,5BH,08H,00H,01H ;23

DB 07H,5BH,5BH,5BH,08H,00H,01H ;22

DB 7DH,5BH,06H,5BH,08H,00H,01H ;21

DB 6DH,5BH,3FH,5BH,08H,00H,01H ;20

DB 66H,5BH,6FH,06H,08H,00H,01H ;19

DB 4FH,5BH,7FH,06H,08H,00H,01H ;18

DB 5BH,5BH,07H,06H,08H,00H,01H ;17

DB 06H,5BH,7DH,06H,08H,00H,01H ;16

DB 3FH,5BH,6DH,06H,08H,00H,01H ;15

DB 6FH,06H,66H,06H,08H,00H,01H ;14

DB 7FH,06H,4FH,06H,08H,00H,01H ;13

DB 07H,06H,5BH,06H,08H,00H,01H ;12

DB 7DH,06H,06H,06H,08H,00H,01H ;11

DB 6DH,06H,3FH,06H,08H,00H,01H ;10

DB 66H,06H,6FH,3FH,08H,00H,01H ;09

DB 4FH,06H,7FH,3FH,08H,00H,01H ;08

DB 5BH,06H,07H,3FH,08H,00H,01H ;07

DB 06H,06H,7DH,3FH,08H,00H,01H ;06

DB 3FH,06H,6DH,3FH,08H,00H,01H ;05

DB 6FH,3FH,66H,3FH,08H,00H,01H ;04

DB 7FH,3FH,4FH,3FH,08H,00H,01H ;03

DB 07H,3FH,5BH,3FH,08H,00H,01H ;02

DB 7DH,3FH,06H,3FH,08H,00H,01H ;01


;--------------------------------------------------------------;


ST2: MOV R5,#5; The main road lights up yellow for 5 seconds, and the branch road lights up red for 5 seconds

DIS2: MOV A,R5

JNZ NEXT2; if 5s has been reduced to 0, jump to the next state ST3

AJMP ST3

NEXT2: MOV A,#5

CLR C

SUBB A, R5 ; Subtract to get the time that has passed

MOV B,A

MOV A,#07H ; Get the jump offset from the table

I have AB

MOV DPTR,#TAB2

ADD A,DPL ; add offset

MOV DPL,A

MOV A,#00H

ADDC A, VAT

IOV VAT, A

MOV A, R4

JZ NOSP2 ; If the chirping time is not 0, chirp (negate p1.2), otherwise do not chirp

CPL P1.2

NOSP2: MOV A,#00H; Dynamic display, cycle lighting of digital tubes

MOV P0,#00H

MOV P2,#0FFH

MOVC A,@A+DPTR

MOV P0,A ; Display the unit digit of the branch

INC DPTR

MOV A,#00H

MOV P0,#00H

MOV P2, #0F6H

MOVC A,@A+DPTR

MOV P0,A ; Display branch tens digit

INC DPTR

MOV A,#00H

MOV P0,#00H

MOV P2,#0F5H

MOVC A,@A+DPTR

MOV P0,A ; Display the main line unit

INC DPTR

MOV A,#00H

MOV P0,#00H

MOV P2, #0F4H

MOVC A,@A+DPTR

MOV P0,A ; Display the main road tens

INC DPTR

MOV A,#00H

MOV P0,#00H

MOV P2,#0F2H

MOVC A,@A+DPTR

MOV P0,A; The following 3 outputs show the main branch lighting status

INC DPTR

MOV A,#00H

MOV P0,#00H

MOV P2,#0F1H

MOVC A,@A+DPTR

MOV P0,A

INC DPTR

MOV A,#00H

MOV P0,#00H

MOV P2,#0F0H

MOVC A,@A+DPTR

MOV P0,A

MOV P0,#00H

MOV P2,#0FFH

AJMP DIS2 ; Return to the start cycle and light up the digital tube


TAB2: DB 6DH,3FH,6DH,3FH,08H,01H,00H ;05

DB 66H,3FH,66H,3FH,08H,01H,00H ;04

DB 4FH,3FH,4FH,3FH,08H,01H,00H ;03

DB 5BH,3FH,5BH,3FH,08H,01H,00H ;02

DB 06H,3FH,06H,3FH,08H,01H,00H ;01


;--------------------------------------------------------------;


ST3: MOV R5,#25; The branch road lights up green for 25 seconds, and the main road lights up red for 25 seconds

DIS3: MOV A,R5

JNZ NEXT3; If 25s has been reduced to 0, jump to the next state ST4

AJMP ST4

NEXT3: MOV A,#25

CLR C

SUBB A, R5 ; Subtract to get the time that has passed

MOV B,A

MOV A,#07H ; Get the jump offset from the table

I have AB

MOV DPTR,#TAB3

ADD A,DPL ; add offset

MOV DPL,A

MOV A,#00H

ADDC A, VAT

IOV VAT, A

MOV A, R4

JZ NOSP3 ; If the chirping time is not 0, chirp (negate p1.2), otherwise do not chirp

CPL P1.2

NOSP3: MOV A,#00H; Dynamic display, cycle lighting of digital tubes

MOV P0,#00H

MOV P2,#0FFH

MOVC A,@A+DPTR

MOV P0,A ; Display the unit digit of the branch

INC DPTR

MOV A,#00H

MOV P0,#00H

MOV P2, #0F6H

MOVC A,@A+DPTR

MOV P0,A ; Display branch tens digit

INC DPTR

MOV A,#00H

MOV P0,#00H

MOV P2,#0F5H

MOVC A,@A+DPTR

MOV P0,A ; Display the main line unit

INC DPTR

MOV A,#00H

MOV P0,#00H

MOV P2, #0F4H

MOVC A,@A+DPTR

MOV P0,A ; Display the main road tens

INC DPTR

MOV A,#00H

MOV P0,#00H

MOV P2,#0F2H

MOVC A,@A+DPTR

MOV P0,A; The following 3 outputs show the main branch lighting status

INC DPTR

MOV A,#00H

MOV P0,#00H

MOV P2,#0F1H

MOVC A,@A+DPTR

MOV P0,A

INC DPTR

MOV A,#00H

MOV P0,#00H

MOV P2,#0F0H

MOVC A,@A+DPTR

MOV P0,A

MOV P0,#00H

MOV P2,#0FFH

AJMP DIS3 ; Return to the start cycle and light up the digital tube


TAB3: DB 6DH,5BH,3FH,4FH,01H,00H,08H ;25

DB 66H,5BH,6FH,5BH,01H,00H,08H ;24

DB 4FH,5BH,7FH,5BH,01H,00H,08H ;23

DB 5BH,5BH,07H,5BH,01H,00H,08H ;22

DB 06H,5BH,7DH,5BH,01H,00H,08H ;21

DB 3FH,5BH,6DH,5BH,01H,00H,08H ;20

DB 6FH,06H,66H,5BH,01H,00H,08H ;19

DB 7FH,06H,4FH,5BH,01H,00H,08H ;18

DB 07H,06H,5BH,5BH,01H,00H,08H ;17

DB 7DH,06H,06H,5BH,01H,00H,08H ;16

DB 6DH,06H,3FH,5BH,01H,00H,08H ;15

DB 66H,06H,6FH,06H,01H,00H,08H ;14

DB 4FH,06H,7FH,06H,01H,00H,08H ;13

DB 5BH,06H,07H,06H,01H,00H,08H ;12

DB 06H,06H,7DH,06H,01H,00H,08H ;11

DB 3FH,06H,6DH,06H,01H,00H,08H ;10

DB 6FH,3FH,66H,06H,01H,00H,08H ;09

DB 7FH,3FH,4FH,06H,01H,00H,08H ;08

DB 07H,3FH,5BH,06H,01H,00H,08H ;07

DB 7DH,3FH,06H,06H,01H,00H,08H ;06

DB 6DH,3FH,3FH,06H,01H,00H,08H ;05

DB 66H,3FH,6FH,3FH,01H,00H,08H ;04

DB 4FH,3FH,7FH,3FH,01H,00H,08H ;03

DB 5BH,3FH,07H,3FH,01H,00H,08H ;02

DB 06H,3FH,7DH,3FH,01H,00H,08H ;01


;--------------------------------------------------------------;


ST4: MOV R5,#5; The main road lights up yellow for 5 seconds, and the branch road lights up red for 5 seconds

DIS4: MOV A,R5

JNZ NEXT4; if 5s has been reduced to 0, jump to the next state ST3

AJMP ST1

NEXT4: MOV A,#5

CLR C

SUBB A, R5 ; Subtract to get the time that has passed

MOV B,A

MOV A,#07H ; Get the jump offset from the table

I have AB

MOV DPTR,#TAB4

ADD A,DPL ; add offset

MOV DPL,A

MOV A,#00H

ADDC A, VAT

IOV VAT, A

MOV A, R4

JZ NOSP4 ; If the chirping time is not 0, chirp (negate p1.2), otherwise do not chirp

CPL P1.2

NOSP4: MOV A,#00H; Dynamic display, cycle lighting of digital tubes

MOV P0,#00H

MOV P2,#0FFH

MOVC A,@A+DPTR

MOV P0,A ; Display the unit digit of the branch

INC DPTR

MOV A,#00H

MOV P0,#00H

MOV P2, #0F6H

MOVC A,@A+DPTR

MOV P0,A ; Display branch tens digit

INC DPTR

MOV A,#00H

MOV P0,#00H

MOV P2,#0F5H

MOVC A,@A+DPTR

MOV P0,A ; Display the main line unit

INC DPTR

MOV A,#00H

MOV P0,#00H

MOV P2, #0F4H

MOVC A,@A+DPTR

MOV P0,A ; Display the main road tens

INC DPTR

MOV A,#00H

MOV P0,#00H

MOV P2,#0F2H

MOVC A,@A+DPTR

MOV P0,A; The following 3 outputs show the main branch lighting status

INC DPTR

MOV A,#00H

MOV P0,#00H

MOV P2,#0F1H

MOVC A,@A+DPTR

MOV P0,A

INC DPTR

MOV A,#00H

MOV P0,#00H

MOV P2,#0F0H

MOVC A,@A+DPTR

MOV P0,A

MOV P0,#00H

MOV P2,#0FFH

AJMP DIS4 ; Return to the start loop and light up the digital tube


TAB4: DB 6DH,3FH,6DH,3FH,01H,08H,00H ;05

DB 66H,3FH,66H,3FH,01H,08H,00H ;04

DB 4FH,3FH,4FH,3FH,01H,08H,00H ;03

DB 5BH,3FH,5BH,3FH,01H,08H,00H ;02

DB 06H,3FH,06H,3FH,01H,08H,00H ;01


;--------------------------------------------------------------;


;Timer interrupt service routine

TIMER1: MOV TH0,#3CH

MOV TL0,#10H

DJNZ R6,BACK

DEC R5

MOV R6,#20

MOV A, R4

JZ BACK

DEC R4

BACK: RETI


; Red light running external interrupt service routine

INTER: MOV R4,#5; External analog red light input, buzzer beeps for 5 seconds

RARELY

END


Reference address:Hot51 enhanced MCU development board schematic diagram

Previous article:Connection diagram of 51 MCU and NRF24L01 wireless module
Next article:51 MCU drives 74hc595 chip program

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号