Current location - Education and Training Encyclopedia - Graduation thesis - Single-chip LCD clock paper
Single-chip LCD clock paper
5 1 single chip microcomputer electronic clock program. Remove the alarm clock without buzzer. This is related to *05 1, and not all of them are used. 89c205 1 is enough. In fact, this broken watch doesn't need a microcontroller at all.

Tempering number eq30h

Seconds eq31h

The shortest EQU time is 32H.

EQU time 33 hours

NUM EQU 34H

Tim ·EQU 35H

EQU time 36H

EQU prefecture 37H

Taiwan Province EQU 38 hours

Temper _ heq39h

EQU 3AH

Light eq00h

Moon EQU 04H

Ring EQU 02H

EQU postal code 1 1H

Exist_ 18B20 EQU 06H

DQ EQU P 1.3

Organization 0000H

LJMP manager

ORG 000BH

LJMP int_t0

Mainly: MOV SP, #40H

MOV oblast, #00H

Mov Tempering Quantity, #03h

MOVno. 55H

MOV minimum, #59H

MOV time, # 1 1H

MOV TW _ NUM # 00H

SETB light; Bright state

CLR moon; afternoon

SETB ring; The alarm went off.

CLR TEM _ ST did not issue a temperature conversion command.

Lcall initialization timing

aa:lcall name _ disp

ajmp aa

; Timing initialization

Initialization timing:

MOV TMOD,#0 1H

MOV TH0,#03BH

MOV TL0,#03CH

SETB TR0; Start T0

SETB ET0; Allow T0 interrupt

SETB EA; CPU interrupt is fully open.

Soak in water to soften

; Memory initialization

Initialize memory:

MOV oblast, #00H

MOVno. 50H

MOV minimum, #59H

MOV time, # 1 1H

MOV TW _ NUM # 00H

MOV number, #00H

MOV Time Minute, #00H

MOV time, # 12

SETB light; Bright state

SETB moon; afternoon

CLR ring; Alarm off

CLR TEM _ ST did not issue a temperature conversion command.

CLR EXIST_ 18b20

Soak in water to soften

; Show subroutine, and show two pipes at the same time.

; Entry: Number displayed by R6 (compressed BCD code)

; R7 shows the position of the digital tube (height 2, 4, 6, 8).

Display: press ACC

MOV ACC,R3

Push ACC

R2 MOV administrative region

Push ACC

MOV·R2, ranked second.

R6 MOV

Exchange a

DI 1:

ANL A,#0FH

Push ACC

MOV A,R7

MOV R3,A

MOV A,#0FEH

DI2:

RR A

DJNZ R3,DI2

MOV R3,A

Popular ACC

SETB P 1.7

MOV DPTR,#CODE_TAB

MOVC A,@A+DPTR

CLR TI

MOV· Spoff

JNB titanium, USD

CLR TI

MOV SBUF,R3

JNB titanium, USD

CLR P 1.7

LCALL delay 1

7 December

R6 MOV

DJNZ R2,DI 1

Popular ACC

MOV·R2

Popular ACC

MOV R3,A

Popular ACC

Soak in water to soften

CODE_TAB:DB 040H,079H,24H,30H, 19H, 12H

DB 02H,78H,00H, 10H,48H,7FH

DB 16H, 10H,46H,40H

; BCD code plus a subroutine

; Entry: R7 data address (

; Exit: b plus the value of 1 (the original value has been changed).

ADD_ 1: push ACC

MOV ACC,R0

Push ACC

MOV A,R7

MOV R0,A

MOV A,@R0

Company a

adalin

MOV @R0,A

Movie b, a

Popular ACC

MOV R0,A

Popular ACC

Soak in water to soften

; Minus one (00 after 59)

; Entry: R7 data address

;

SUB_ 1_60: Push ACC

MOV ACC,R0

Push ACC

Push PSW

MOV A,R7

MOV R0,A

MOV A,@R0

CJNE A,#00H,SU 10

MOV @R0,#59H

POP PSW

Popular ACC

MOV R0,A

Popular ACC

Soak in water to soften

SU 10:CLR C

SUBB A,# 1

MOV angle

JNC SU20

SUBB A, no.5

MOV @R0,A

POP PSW

Popular ACC

MOV R0,A

Popular ACC

Soak in water to soften

; Minus one (12 equals 1)

; Entry: R7 data address

;

SUB_ 1_ 12: Push ACC

MOV ACC,R0

Push ACC

Push PSW

MOV A,R7

MOV R0,A

MOV A,@R0

CJNE A,#0 1H,SU0 1

MOV @R0,# 12H

POP PSW

Popular ACC

MOV R0,A

Popular ACC

Soak in water to soften

SU0 1:CLR C

SUBB A,# 1

MOV angle

Jiannanchun SU02

SUBB A, no.5

MOV @R0,A

POP PSW

Popular ACC

MOV R0,A

Popular ACC

Soak in water to soften

; Delay subroutine

;

DELAY6: Push ACC for 6 milliseconds.

MOV A,R5

Push ACC

R4 MOV

Push ACC

MOV R5 # 0BH

LJMP DL2

DELAY 1: Push ACC delay 1 ms.

MOV A,R5

Push ACC

R4 MOV

Push ACC

MOV R5,#02H

DL2:MOV R4,#0FAH

DJNZ R4, USD

DJNZ R5,DL2

Popular ACC

MOV R5,A

Popular ACC

MOV·R4

Popular ACC

Soak in water to soften

; T0 interrupt service routine

int _ t0:CLR ET0; Turn off interrupt

CLR TR0 closes the counter.

MOV TL0,# 0B8H

MOV TH0, # 03CH Reloading Count (Revised)

SETB TR0; Start counting

Push ACC

Press b

Push PSW

MOV A,R0

Push ACC

MOV A,R 1

Push ACC

R2 MOV

Push ACC

MOV A,R3

Push ACC

R4 MOV

Push ACC

MOV A,R5

Push ACC

R6 MOV

Push ACC

MOV A,R7

Push ACC

MOV A country

CJNE A, #00H, TWINKLE will blink if it is not in 0 state.

; 0 status

Company number

MOV A,NUM

CJNE A, #20H, return; If it does not reach one second, the interrupt ends.

; 1 sec arrival

MOV number, #00H

MOV R7, # seconds

LCALL ADD _ 1; 1 sec, sec plus 1.

MOV A,SEC

CJNE A, #60h, return; Sixty seconds?

; reach

MOV SEC, # 00H seconds clear

MOV R7, # minimum

LCALL ADD _ 1; Add 1

The smallest MOV

CJNE A, #60h, return; 60 minutes

MOV is the smallest, # 00H60 points, zero points.

MOV R7, # hours;

LCALL ADD _ 1; Time plus 1

MOV A,B

CJNE A,# 12H,n 13; Arrival 12?

CPL moon; /kloc-arrive at 0/2 o'clock, and change in the morning and afternoon.

N 13:

CJNE A, # 13H, return; Arrival 13?

MOV time, # 01h; 13 becomes 0 1 when it arrives.

LJMP returns

Blinking: INC TW_NUM

MOV A, Taiwan Province number

CJNE A, #06H, return; 50ms*6=0.3s to?

MOV TW_NUM, # 0H0.3s, the count is cleared.

LCALL TW_DISP

CPL lamp; Flip the bright and dark.

Return:

Popular ACC

MOV R7,A

Popular ACC

MOV·R6

Popular ACC

MOV R5,A

Popular ACC

MOV·R4

Popular ACC

MOV R3,A

Popular ACC

MOV·R2

Popular ACC

MOV R 1,A

Popular ACC

MOV R0,A

POP PSW

Bopu B.

Popular ACC

SETB ET0

Retty

; Display hour subroutine

; Entry parameter: b is the display content.

DISP time:

Push ACC

R6 MOV

Push ACC

MOV A,R7

Push ACC

MOV A,B

JNB· moon, DISP time

Add one, #20H

DISP time:

Add one, #0C0H

MOV·R6

MOV R7,#08H

LCALL display

Popular ACC

MOV R7,A

Popular ACC

MOV·R6

Popular ACC

Soak in water to soften

; Normal display subroutine (no entrance and exit parameters)

Nomination _DISP: push ACC

MOV R0,A

Push ACC

MOV R5,A

Push ACC

MOV·R6

Push ACC

MOV R7,A

Push ACC

MOV R7, # 02H initial display position

MOV R5, # 03H period

MOV R0, # tempering quantity;

NOM 1: MOV A,@R0

MOV·R6

MOV A,R7

Push ACC protection R7

LCALL display

Popular ACC

MOV R7,ACC

INC R0

INC R7

INC R7 display position moves up.

djnz R5,NOM 1

MOV B,@R0

LCALL DISP hours; Display hour

Popular ACC

MOV R7,A

Popular ACC

MOV·R6

Popular ACC

MOV R5,A

Popular ACC

MOV R0,A

Popular ACC

Soak in water to soften

; Texan

TW_DISP: push attachment.

R4 MOV

Push ACC

R6 MOV

Push ACC

MOV A,R7

Push ACC

MOV R4 oblast

CJNE R4,#0 1H,STATE2

STATE 1:MOV B, hours; Status 1: normal, secondary correction.

LCALL DISP hours; When the hours are displayed normally.

JNB lamp, TD 1

MOV·R6, Minnesota

MOV R7, # 06H shows time and highlights.

LCALL display

LJMP time _ D _ end

TD 1:MOV R6, # 0BBH bright and dark spots

MOV R7,#06H

LCALL display

LJMP time _ D _ end

State 2:MOV R4 State

CJNE R4, No.02, State No.3

MOV·R6;, Minnesota; Normal display

MOV R7, No.6

LCALL display

JNB lamp, TD2

MOV B, hours; When the display is bright

DISP time

LJMP time _ D _ end

TD2:MOV R6, # 0BBH shows dark time.

MOV R7,#08H

LCALL display

LJMP time _ D _ end

State 3:MOV R4 State

CJNE R4, No.03, 4th canton

MOV B, TIM _ HOUR status 1: normal, secondary correction.

LCALL DISP hours; When the hours are displayed normally.

JNB lamp, TD3

Tim ·MOV·R6

MOV R7, # 06H shows time and highlights.

LCALL display

LJMP time _ D _ end

TD3:MOV R6, # 0BBH bright and dark spots

MOV R7,#06H

LCALL display

LCALL DISP _ RING; Alarm display

LJMP time _ D _ end

State 4:MOV R4 State

CJNE R4,#04,T _ D _ END

MOV R6, Timming; Normal display

MOV R7, No.6

LCALL display

JNB lamp, TD4

MOV B, hours; When the display is bright

DISP time

LJMP time _ D _ end

TD4:MOV R6, # 0BBH shows dark time.

MOV R7,#08H

LCALL display

Call DISP

T_D_END: pop up ACC.

MOV R7,A

Popular ACC

MOV·R6

Popular ACC

MOV·R4

Popular ACC

Soak in water to soften

DISP _ ring:

Push acc

mov acc,r6

Push acc

mov acc,r7

Push acc

Jnb ring, driving1

Mov r6, # 0aH turns on "0n"

mov r7,#02H

Lcall display

ajmp DR_end

DRING 1:

Mov r6, # 00h Turn on "00"

mov r7,#02H

Lcall display

DR_end: pop-up acc

Mov r7, attachment

Popular acc

mov r6,a

Popular acc

Soak in water to soften

; Keyboard processing

KEY_DEAL: push ACC

R4 MOV

Push ACC

MOV A,R7

Push ACC

KEY_D 1: LCALL TW_DISP

KEY_ADD: JB P 1.4, and KEY _ SUB is an add key?

LCALL TW _ DISP; Delay & gt8ms

JB P 1.4, KEY _ SUB is an add key?

MOV R4 oblast; be

CJNE R4, #0 1, KA _ ST2 status 1 (normal display)? If not, go to KA_ST2.

KA_ST 1:MOV R7,#MIN

LCALL ADD _ 1; miniute Add 1;

Securities and Exchange Commission MOV·R4

CJNE R4,#60H,ka 1; Is it 60 seconds?

MOV SEC, # 00H is, safety seconds.

KA 1: AJMP KEY_SUB

KA_ST2: MOV R4 oblast

CJNE R4, #02H, ST3 card

MOV R7, # hours;

LCALL ADD_ 1

MOV R4, hours

Kane R4, # 13H, KA2

MOV time, #0 1H

KA2:AJMP KEY_SUB

Kast3: Movr4 oblast

CJNE R4,#03H,KA_ST4

MOV R7, # Minimum time

LCALL ADD_ 1

Tim ·MOV·R4

CJNE R4,#60H,KA3

MOV Time Minute, #00H

KA3:AJMP KEY_SUB

KA_ST4: MOV R4 oblast

CJNE R4,#04H,KA4

MOV R7, # time _ hours

LCALL ADD_ 1

MOV·R4, time

CJNE R4,# 13H,KA4

MOV time, #0 1H

KA4:NOP

; Explicit call

KEY_SUB: JB P3.3, KEY _ CAL subkey?

LCALL TW _ DISP;

JB P3.3, KEY _ CAL subkey?

KS_ST 1:MOV R4, state; Subkey

CJNE r4, #0 1H, KS _ ST2 status 1?

MOV R7, # MIN status 1

LCALL SUB_ 1_60

ajmp KEY_CAL

KS_ST2:MOV R4 oblast

Kane R4, #02H, ST3, Kansas

MOV R7, # hours

LCALL SUB_ 1_ 12

ajmp KEY_CAL

St3, Kansas: MOVR4

CJNE R4,#03H,KS_ST4

MOV R7, # Minimum time

LCALL SUB_ 1_60

ajmp KEY_CAL

KS_ST4:MOV R4 oblast

CJNE R4,#04H,KEY_CAL

MOV R7, # time _ hours

LCALL SUB_ 1_ 12

; Explicit call

KEY_CAL: JB P 1.5,KEY_FUN

LCALL TW_DISP

JB P 1.5,KEY_FUN

MOV R4 oblast

CJNE R4,#03H,KC_ST4

KC:

CPL ring

AJMP KEY_FUN

MOV R4 oblast

CJNE R4,#04H,KEY_FUN

CPL ring

; Explicit call

KEY_FUN: JB P3.4,To_KEY_ADD

LCALL TW_DISP

JB P3.4,To_KEY_ADD

Company status

MOV R4 oblast

CJNE R4,#05H,TO_KEY_D 1

MOV oblast, #00H

Ljmp key output

To_KEY_ADD:ljmp KEY_ADD

TO _ KEY _ d 1:LJMP KEY _ d 1

Keyed output:

Popular ACC

MOV R7,A

Popular ACC

MOV·R4 Airlines

Popular ACC

Soak in water to soften

CFG_ 18B20:

JB Exist_ 18B20,RE _ config 1; If DS 18B20 exists, go to RE_CONFIG 1.

Soak in water to soften

Reconfigure 1:

MOV A, # 0CCH issues a command to skip ROM.

LCALL write _ byte

MOV A, # 4EH Write Temporary Storage Command

LCALL write _ byte

MOV A, # 00H Write 00H in TH (upper alarm limit).

LCALL write _ byte

MOV A, # 00H Write 00H (lower alarm limit) in TL.

LCALL write _ byte

Soak in water to soften