Git Product home page Git Product logo

hardtraing18's People

Stargazers

 avatar  avatar

Watchers

 avatar

hardtraing18's Issues

矩阵键盘+数码管

 timecount EQU 40H
 miaoL EQU 73H
 miaoH EQU 72H
 tim EQU 50H
 ORG 0000H
 LJMP MAIN
 ORG 000BH
 LJMP timer0_ser
 ORG 0030H

MAIN:
MOV R0,#70H
MOV R7,#04H
MOV A,#00H

M1:
MOV @r0,A
INC R0
DJNZ R7, M1

LCALL inittimer

SETB EA
SETB TR0

MOV timecount,#0AH

LP:
LCALL DISP
LCALL key_scan
SJMP LP

DISP:
MOV R6,#0EFH
MOV R7,#04H
MOV R0,#70H

DIS1:
MOV A,R6
MOV P3,A

MOV A,@R0
MOV DPTR,#TAB
MOVC A,@A+DPTR
MOV P1,A

LCALL DELAY

MOV A,R6
RL A
MOV R6,A
INC R0
DJNZ R7,DIS1

RET

TAB:
DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H
DB 7FH,6FH,77H,7CH,39H

DELAY:
PUSH 03H
PUSH 04H
MOV R3,#0AH
D2: MOV R4,#1FH
D1: DJNZ R4,D1
DJNZ R3,D2
POP 04H
POP 03H
RET

inittimer:
MOV TMOD,#01H
MOV TH0,#3CH
MOV TL0,#0B0H
SETB ET0
RET

timer0_ser:
MOV TH0,#3CH
MOV TL0,#0B0H

DJNZ timecount,trtn
MOV timecount,#00H
INC miaoL
MOV A,miaoL
CJNE A,#0AH,trtn
MOV miaoL,#00H
INC miaoH
MOV A,miaoH
CJNE A,#06H,trtn
MOV miaoH,#00H

trtn:
RETI

key_scan:
MOV P1,#00H
LCALL ks
JZ krtn

MOV R5,#0EFH
MOV R7,#04H
MOV R1,#00H
MOV R2,#00H

kloop:
MOV A,R5
MOV P3,A
NOP
NOP
MOV A,P3
CPL A
ANL A,#0FH
JZ next
JB ACC.0,row1
JB ACC.1,row2
JB ACC.2,row3
JB ACC.3,row4
SJMP krtn

row1:
MOV R2,#00H
SJMP keyhandle
row2:
MOV R2,#04H
SJMP keyhandle
row3:
MOV R2,#08H
SJMP keyhandle
row4:
MOV R2,#0cH
SJMP keyhandle

next:
INC R1
MOV A,R5
RL A
MOV R5,A
DJNZ R7,kloop
SJMP krtn

keyhandle:
MOV A,R2
ADD A,R1
PUSH ACC

keywait:
LCALL ks
JNZ keywait
POP ACC
LCALL keyresult

krtn:
RET

ks:
MOV A,#0FH
MOV P3,A
NOP
NOP
MOV A,P3
CPL A
ANL A,#0FH
RET

keyresult:
CJNE A,#00H,kk1
MOV R2,miaoL
CJNE R2,#09H,kkk1
MOV miaoL,#00H
SJMP krrtn

kkk1:
INC miaoL
SJMP krrtn

kk1:
CJNE A,#01H,krrtn
MOV R2,miaoH
CJNE R2,#05H,kkk2
MOV miaoH,#00H
SJMP krrtn
kkk2: INC miaoH
krrtn: RET

END

定时器

ORG 0000H
LJMP MAIN

ORG 000BH
LJMP T0_DEL

ORG 001BH
LJMP T1_DEL

ORG 0100H

MAIN:
SETB IE.1
SETB IE.3
SETB IE.7

MOV TMOD , #01000010B
MOV TL0 ,#0ADH
MOV TH0 ,#0D3H

MOV TH1 ,#0FFH
MOV TL1 ,#0FBH

MOV P1,#00H

SETB TCON.6
SETB TCON.4

MOV R7,#00H

AJMP $

T0_DEL:
INC R7
CLR TF0
CJNE R7,#014H,NOTT
MOV R7,#00H
CPL P1.0
RETI
NOTT:
RETI

T1_DEL:
MOV TH1 ,#0FFH
MOV TL1 ,#0FBH
CPL P1.2
RETI
NOTT1:
RETI

中断汇编版

	ORG 0000H
	LJMP MAIN

	ORG 0003H
            LJMP INT0_DEL

	ORG 0013H
	LJMP INT1_DEL

	ORG 0100H

MAIN:
SETB IE.2
SETB IE.0
SETB IE.7
MOV 90H,#00H
SJMP $

INT0_DEL:
MOV R4,#01H

LOOP1:
CPL P1.0
ACALL DELAY
CPL P1.0
ACALL DELAY
DJNZ R4,LOOP1
MOV 90H,#00H
RETI

DELAY:
MOV R7,#10
D1:
MOV R6,#200
D2:
MOV R5,#250
DJNZ R5,$
DJNZ R6,D2
DJNZ R7,D1
RET

INT1_DEL:
MOV 90H,#001H
MOV R4,#08H
LOOP:
MOV A,90H
RL A
MOV 90H,A
ACALL DELAY
DJNZ R4,LOOP
MOV 90H,#000H
RETI

数码管

 ORG 0000H
 LJMP MAIN
 ORG 0030H

MAIN:
MOV R0,#70H
MOV R7,#04H
MOV A,#00H

M1:
MOV @r0,A
INC A
INC R0
DJNZ R7, M1

LP:
LCALL DISP
SJMP LP

DISP:
MOV R6,#0EFH
MOV R7,#04H
MOV R0,#70H

DIS1:
MOV A,R6
MOV P3,A
MOV A,@r0
MOV DPTR,#TAB
MOVC A,@A+DPTR
MOV P1,A
LCALL DELAY

MOV A,R6
RL A
MOV R6,A
INC R0
DJNZ R7,DIS1

RET

TAB:
DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H
DB 7FH,6FH,77H,7CH,39H

DELAY:
MOV R3,#0AH
d2: MOV R4,#1FH
d1:
DJNZ R4,d1
DJNZ R3,d2
RET

END

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.