⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 广告led.asm

📁 这是一些用汇编做的单片机程序
💻 ASM
📖 第 1 页 / 共 2 页
字号:
	;救火车显示屏控制板--cjxwzk.pcb查询方式
	; 无--------液压分组控制,不复位
	;单窗户分开记数
	.include"d:\avrtools\appnotes\8515def.inc"
	.equ hc595_da=7		;portc,7
	.equ hc595_cl=5		;portc,5
	.equ hc595_en=6		;portc,6
	.equ hc595_cr=4		;portc,4
	.equ s4017_cr=0		;portc,0
	.equ s4017_clk1=1	;portc,1
	.equ s4017_clk2=2	;portc,2
	.equ s4017_clk3=3	;portc,3
	.equ beijing=0x0f60
	.equ tbxplay=0x03e0
	.equ ren1=0x04e0
	.equ ren2=0x05e0
	.equ yi=0x0660
	.equ er=0x06e0
	.equ san=0x0760
	.equ si=0x07e0
	.equ wu=0x0860
	.equ liu=0x08e0
	.equ qi=0x0960
	.equ ba=0x09e0
	.equ jiu=0x0a60
	.equ lin=0x0be0
	.equ xiao=0x0c60
	.equ ku=0x0d60
	.equ xfyx=0x0e60
	.equ qd=5	;pb5 	启动电平"1"有效
	.equ jcyi=0	;pb2 	一号击中信号
	.equ jcer=1	;pb3 	二号击中信号
	.equ jcsan=2	;pb4 	三号击中信号
	.equ xws=3	;pb3 	液压上限位信号
	.equ xwx=4	;pb4 	液压下限位信号
	.equ yefas=0;pa0 	液压阀-上
	.equ yefax=1;pa1	液压阀-下
	.equ yipy=5	;pa5 	一号喷烟
	.equ erpy=6	;pa6 	二号喷烟
	.equ sanpy=7	;pa7	三号喷烟---改为警灯
	.equ dnyi1=6	;pb6	灯一/1
	.equ dnyi2=7	;pb7	灯一/2
	.equ dnyi3=0	;pd0	灯一/3
	.equ dner1=1	;pd1	灯二/1
	.equ dner2=2	;pd2	灯二/2
	.equ dner3=3	;pd3	灯二/3
	.equ dnsan1=4	;pd4	灯三/1
	.equ dnsan2=5	;pd5	灯三/2
	.equ dnsan3=6	;pd6	灯三/3
	.def temp1=r7
	.def temp2=r8
	.def temp3=r9
	.def yijzs=r6
	.def erjzs=r11
	.def snjzs=r12
	.def jsq=r24
	.def tempdh=r19			
	.def tempdl=r20
	.def tempgg=r21
	.def cnt=r22
	.def s4017_cnt=r23
	.def szcnt=r27
	.def qszzzh=r28
	.def qszzzl=r29
	.org 0
	rjmp reset
	;.org 1
	;rjmp intr0
	.org $0008
reset:	ldi r16,high(RAMEND)
	out sph,r16
	ldi r16,low(RAMEND)
	out spl,r16
	ldi r16,13
	out wdtcr,r16
	ldi r16,192
	
	out portb,r16
	out ddrb,r16
	
	out portc,r16
	
	ldi r16,255
	out ddrc,r16
	ldi r16,255
	out portd,r16
	out ddrd,r16
	
	out porta,r16
	out ddra,r16
	clr r19
	clr r20
	clr r21
	clr r22
	clr r23
	clr jsq
	clr temp1
	clr temp2
	clr temp3
	clr yijzs
	clr erjzs
	clr snjzs
	sbi portc,hc595_cr
main:
	rcall ql595
	sbi portc,s4017_cr
	nop
	cbi portc,s4017_cr

	cbi portc,hc595_en
	;cbi porta,yefas
fw:	;sbis pinb,xwx
	;rjmp fw1
	;sbi porta,yefas

;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
tbxb:	;sbis pinb,qd
	;rjmp play;xs1
	
	wdr

	ldi r16,255
	out portd,r16
	out ddrd,r16
	out porta,r16
	out ddra,r16
	sbi ddrb,6
	sbi ddrb,7
	sbi portb,6
	sbi portb,7
	clr jsq
	clr r19
	clr r20
	clr r21
	clr r22
	clr r23
	;clr jsq
	clr temp1
	clr temp2
	clr temp3
	clr yijzs
	clr erjzs
	clr snjzs
	;cbi porta,yefas
fw1:	;sbis pinb,xwx
	;rjmp fw1
	;sbi porta,yefas
		;sbis pinb,qd	;sbis
		;rjmp plxs1
	ldi r16,255
	mov r13,r16
xhb1:	ldi r16,8
	mov r14,r16
xhb:	ldi r25,24
ywdata:	inc s4017_cnt
		rcall qudata
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
		rcall qudata
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
		rcall qudata
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
		rcall qudata
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
	
	rcall ledxs
		;sbis pinb,qd
		;rjmp plxs1
	dec r25
	brne ywdata

clrcnt:	clr cnt
	dec r14
	brne xhb
	dec r13
	brne xhb1
	clr cnt
	clr s4017_cnt
;@@@@@@@@@@@@@@@@@@@@@@@@@
tbxxfp:	ldi r16,255
	mov r13,r16
xhxfp1:	ldi r16,8	
	mov r14,r16
xhxfp:	ldi r25,24
ywpxfda:	inc s4017_cnt
		rcall xfda
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
		rcall xfda
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
		rcall xfda
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
		rcall xfda
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
	
	rcall ledxs
		;sbis pinb,qd
		;rjmp plxs1
	dec r25
	brne ywpxfda

	clr cnt
	dec r14
	brne xhxfp
	dec r13
	brne xhxfp1
	clr cnt
	clr s4017_cnt
	
;	rjmp tbxb
;@@@@@@@@@@@@@@@@@@@@
;@@@@@@@@@@@@@@@@@@@@@@@@@
tbxp:	ldi r16,255
	mov r13,r16
xhp1:	ldi r16,8	
	mov r14,r16
xhp:	ldi r25,24
ywpda:	inc s4017_cnt
		rcall qupda
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
		rcall qupda
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
		rcall qupda
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
		rcall qupda
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
	
	rcall ledxs
		;sbis pinb,qd
		;rjmp plxs1
	dec r25
	brne ywpda

	clr cnt
	dec r14
	brne xhp
	dec r13
	brne xhp1
	clr cnt
	clr s4017_cnt
	
	rjmp tbxb
;@@@@@@@@@@@@@@@@@@@@
plxs1:ldi r16,0
	out portd,r16
	sbi ddrb,6
	sbi ddrb,7
	cbi portb,6
	cbi portb,7		;点亮火苗灯
	sbi ddra,sanpy
	cbi porta,sanpy
play:	sbic pinb,qd
	rjmp enplay
	ldi r16,4;8;25;5  plxs1:
	mov r13,r16
xhr1:	ldi r16,8	
	mov r14,r16
xhr:	ldi r25,24
ywr1da:	inc s4017_cnt
	rcall xsqs
		rcall quszda
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
		rcall qur1da
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
		rcall qur1da
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
		rcall qur1da
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
		
	
	rcall ledxs

	dec r25
	brne ywr1da
	clr szcnt
	clr cnt
	dec r14
	brne xhr
	dec r13
	brne xhr1
	clr szcnt
	clr cnt
	clr s4017_cnt
	
;@@@@@@@@@@@@@@@@@@

	rcall jscx
	rcall sxxs
;@@@@@@@@@@@@@@@@@@@@

plxs2:	ldi r16,4;8;25;5
	mov r13,r16
xhr2:	ldi r16,8	
	mov r14,r16
xhr3:	ldi r25,24
ywr2da:	inc s4017_cnt
	rcall xsqs
		rcall quszda
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
		rcall qur2da
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
		rcall qur2da
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
		rcall qur2da
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
		
	
	rcall ledxs

	dec r25
	brne ywr2da
	clr szcnt
	clr cnt
	dec r14
	brne xhr3
	sbi portd,7
	dec r13
	brne xhr2
	clr szcnt
	clr cnt
	clr s4017_cnt
;@@@@@@@@@@@@@@@@@@@@
;	inc jsq
	cpi jsq,10
	brsh qjsq
	rjmp play
qjsq:;	clr jsq
	rjmp tbxb
	;************

enplay:nop
	
	
	cpi jsq,3
	brsh endxxs
	rjmp endkxs
	
;@@@@@@@@@@@@@@@@@@@@

endxxs:	ldi r16,255
	mov r13,r16
xhx1:	ldi r16,8	
	mov r14,r16
xhx2:	ldi r25,24
ywx1da:	inc s4017_cnt
	rcall xsqs
		rcall quszda
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
		rcall xdata
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
		rcall xdata
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
		rcall xdata
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
		
	
	rcall ledxs
		sbis pinb,qd
	rjmp plxs1

	dec r25
	brne ywx1da
	clr szcnt
	clr cnt
	dec r14
	brne xhx2
	sbi portd,7
	dec r13
	brne xhx1
	clr szcnt
	clr cnt
	clr s4017_cnt

	rjmp tbxb
;@@@@@@@@@@@@@@@@@@@@

endkxs:	ldi r16,255
	mov r13,r16
xhk1:	ldi r16,8	
	mov r14,r16
xhk2:	ldi r25,24
ywk1da:	inc s4017_cnt
	rcall xsqs
		rcall quszda
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
		rcall kudata
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
		rcall kudata
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
		rcall kudata
	mov tempgg,tempdl
	rcall cx595
	mov tempgg,tempdh
	rcall cx595
		
	
	rcall ledxs
		sbis pinb,qd
	rjmp plxs1

	dec r25
	brne ywk1da
	clr szcnt
	clr cnt
	dec r14
	brne xhk2
	sbi portd,7
	dec r13
	brne xhk1
	clr szcnt
	clr cnt
	clr s4017_cnt

	rjmp tbxb
;@@@@@@@@@@@@@@@@@@@@


	;************
clk_1:wdr
	cpi s4017_cnt,9
	brsh clk_2
	
	sbi portc,s4017_clk1
	
	nop
	cbi portc,s4017_clk1

	ret
clk_2:wdr	
	cpi s4017_cnt,9
	brne clk12
	sbi portc,s4017_cr
	nop
	cbi portc,s4017_cr
clk12:wdr
	cpi s4017_cnt,17
	brsh clk_3	
	sbi portc,s4017_clk2
	nop
	cbi portc,s4017_clk2

	ret

clk_3:wdr
	cpi s4017_cnt,17
	brne clk23
	sbi portc,s4017_cr
	nop
	cbi portc,s4017_cr
clk23:wdr
	cpi s4017_cnt,24
	brsh clk_4
	

	sbi portc,s4017_clk3
	
	nop
	cbi portc,s4017_clk3

	ret

clk_4:wdr
	cpi s4017_cnt,24
	brne clk34
	
	
	sbi portc,s4017_clk3
	nop
	cbi portc,s4017_clk3
	
clk34:wdr
	sbi portc,s4017_cr
	nop
	cbi portc,s4017_cr
	clr s4017_cnt

	ret
	
	
;************************
ledxs:	;rcall cx595
	rcall clk_1
	sbi portc,hc595_en
	nop
	cbi portc,hc595_en
	;rcall clk_1
	ret
	
	
	
	;取击中数去显示
xsqs:wdr
	cpi jsq,0
	brne qsyi
	ldi qszzzh,high(lin*2)
	ldi qszzzl,low(lin*2)
	ret
qsyi:wdr
	cpi jsq,1
	brne qser
	ldi qszzzh,high(yi*2)
	ldi qszzzl,low(yi*2)
	ret
qser:wdr
	cpi jsq,2
	brne qssan
	ldi qszzzh,high(er*2)
	ldi qszzzl,low(er*2)
	ret
qssan:wdr
	cpi jsq,3
	brne qssi
	ldi qszzzh,high(san*2)
	ldi qszzzl,low(san*2)
	ret
qssi:wdr
	cpi jsq,4
	brne qswu
	ldi qszzzh,high(si*2)
	ldi qszzzl,low(si*2)
	ret
qswu:wdr
	cpi jsq,5
	brne qsliu
	ldi qszzzh,high(wu*2)
	ldi qszzzl,low(wu*2)
	ret
qsliu:wdr
	cpi jsq,6
	brne qsqi
	ldi qszzzh,high(liu*2)
	ldi qszzzl,low(liu*2)
	ret
qsqi:wdr
	cpi jsq,7
	brne qsba
	ldi qszzzh,high(qi*2)
	ldi qszzzl,low(qi*2)
	ret
qsba:wdr
	cpi jsq,8
	brne qsjiu
	ldi qszzzh,high(ba*2)
	ldi qszzzl,low(ba*2)
	ret
qsjiu:wdr
	cpi jsq,9
	brne qsend
	ldi qszzzh,high(jiu*2)
	ldi qszzzl,low(jiu*2)
	
qsend:	ret

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -