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

📄 vfd.asm

📁 一个DVD组合机的MCU代码,FM,机芯出入仓,功放的控制及DVD数据通过通信来访问.
💻 ASM
字号:
;--TAB=8----------------------------------------------------------;
;*****************************************************************;
;*****************************************************************;
;**                                                             **;
;**     VFD.asm							**;
;**                     				        **;
;**                                                             **;
;**     version 1.0 				                **;
;**                                                             **;
;**     update  2002/8/9   YCD					**;
;**                                                             **;
;*****************************************************************;
;*****************************************************************;
;-----------------------------------------------------------------;
$..\SRC\DVD.H
VFD_CLK         EQU	P3.4   	;14 T0
VFD_DIN         EQU	P3.5   	;15 T1
VFD_STB		EQU	P3.6   	;16 WR
VFD_DO          EQU     VFD_DIN
extern _R

;--VFD DISPLAY MOD------------------------------------------------;
VFD_DISPLAYMOD_SEG20	EQU	00000000B  ;8 digits, 20 segments
VFD_DISPLAYMOD_SEG19	EQU	00001000B  ;9 digits, 19 segments
VFD_DISPLAYMOD_SEG18	EQU	00001001B  ;10 digits, 18 segments
VFD_DISPLAYMOD_SEG17	EQU	00001010B  ;11 digits, 17 segments
VFD_DISPLAYMOD_SEG16	EQU	00001011B  ;12 digits, 16 segments
VFD_DISPLAYMOD_SEG15	EQU	00001100B  ;13 digits, 15 segments
VFD_DISPLAYMOD_SEG14	EQU	00001101B  ;14 digits, 14segments
VFD_DISPLAYMOD_SEG13	EQU	00001110B  ;15 digits, 13 segments
VFD_DISPLAYMOD_SEG12	EQU	00001111B  ;16 digits, 12 segments

;--VFD SET DATA MODE-----------------------------------------------;
;0 1 - - b3 b2 b1 b0
;Sets data write and read modes.
;00 : Writes data to display memory.
;01 : Writes data to LED port.
;10 : Reads key data.
;11 : Reads SW data.
;Sets address increment mode (display memory).
;0: Increments address after data has been written.
;1: Fixes address.
;Sets test mode
;0: Normal operation
;1: Test mode
VFD_SET_DISPLAY		EQU   	01000000B
VFD_SET_LED		EQU   	01000001B
VFD_SET_RDKEY		EQU   	01000010B
VFD_SET_SWDATA		EQU   	01000011B

;--VFD DIM---------------------------------------------------------;
;1 0 - - b3 b2 b1 b0
;Sets dimming quantity.
;000  ;: Sets pulse width to 1/16.
;001  ;: Sets pulse width to 2/16.
;010  ;: Sets pulse width to 4/16.
;011  ;: Sets pulse width to 10/16.
;100  ;: Sets pulse width to 11/16.
;101  ;: Sets pulse width to 12/16.
;110  ;: Sets pulse width to 13/16.
;111  ;: Sets pulse width to 14/16.
VFD_DIM1      	EQU     10000000B
VFD_DIM2      	EQU     10000001B
VFD_DIM4      	EQU     10000010B
VFD_DIM10     	EQU     10000011B
VFD_DIM11     	EQU     10000100B
VFD_DIM12     	EQU     10000101B
VFD_DIM13     	EQU     10000110B
VFD_DIM14     	EQU     10000111B

;-VFD OFF ON-----------------------------------;
;Turns on/off display.
;0 ;: Display off (key scan continues*)
;1 ;: Display on
VFD_DISPLAY_OFF	EQU 	00H
VFD_DISPLAY_ON	EQU 	08H

;-----------------------------------------------;
VFD_ADDR_FLAG	EQU	0C0H
extern	gDisplayBuf
;-----------------------------------------------;
	RSEG 	CODE
;-----------------------------------------------;
;Name: Lsb_VfdOutByte				;
;In:	 A					;
;Out:    VFD_CLK  high			        ;
;Update: 2002/8/9				;
;check:  VfdOutByte				;
;-----------------------------------------------;
Lsb_VfdOutByte:
	PUSH	B

	MOV	B,#8
	;-(1)low------;
vob_1:  CLR     VFD_CLK
	NOP
	NOP
	NOP
	RRC	A
	MOV	VFD_DIN,C
	NOP
	NOP
	NOP
	NOP
	NOP

	;-(2)high-----;
	SETB    VFD_CLK
	NOP
	NOP
	NOP
	NOP
	NOP
	DJNZ	B,vob_1

	POP	B
	RET

;-----------------------------------------------;
;Name: Lsb_VfdInByte				;
;In:	 VFD_CLK  high				;
;Out:    A  				        ;
;Update: 2002/8/9				;
;check:  VfdOutByte				;
;-----------------------------------------------;
Lsb_VfdInByte:
	PUSH	B

	MOV	B,#8
	;-(1)low------;
vib_1:	SETB	VFD_DO
	CLR     VFD_CLK
	NOP
	NOP
	NOP
	NOP
	NOP
	MOV	C,VFD_DO
	RRC	A
	;-(2)high-----;
	SETB	VFD_CLK
	NOP
	NOP
	NOP
	NOP
	DJNZ	B,vib_1

	POP	B
	RET

;-----------------------------------------------;
;Name: Lsb_VfdWriteCommand			;
;In:	 A					;
;Out:    NO                                     ;
;Update: 2002/8/9				;
;check:  VfdWriteCommand			;
;-----------------------------------------------;
Lsb_VfdWriteCommand:
	CLR	VFD_STB
	CALL	Lsb_VfdOutByte
	SETB	VFD_STB
	RET

;-----------------------------------------------;
;Name: Lsb_VfdWriteData				;
;In:	 R1=ADDR,A=data				;
;Out:    NO                                     ;
;Update: 2002/8/9				;
;check:  VfdWriteData				;
public WriteScreenRam                           ;
;-----------------------------------------------;
WriteScreenRam:
Lsb_VfdWriteData:
	;-(1) SET DATA TYPE-------;
	MOV	A,#VFD_SET_DISPLAY
	CALL	Lsb_VfdWriteCommand

	CLR	VFD_STB
	;-(2)ADDR--;
	MOV	A,R6
	ORL	A,#VFD_ADDR_FLAG
	CALL    Lsb_VfdOutByte
	;-(3)DATA--;
	MOV	A,R7
	CALL    Lsb_VfdOutByte
	SETB	VFD_STB

	RET

;-----------------------------------------------;
;Name: Lsb_VfdReadKey				;
;In:	 R1=ADDR,A=data				;
;Out:    NO                                     ;
;Update: 2002/8/9				;
;check:  VfdWriteData				;
public  Lsb_VfdReadKey                          ;
extern  gVfdkeyBuf                              ;
;-----------------------------------------------;
Lsb_VfdReadKey:
	PUSH	B
	PUSH	_R

	CLR	VFD_STB
	;-(1)SET DATA-----------;
	MOV	A,#VFD_SET_RDKEY
	CALL    Lsb_VfdOutByte

	;-(2)READ KEY----------;
	MOV	R0,#gVfdkeyBuf
	MOV	B,#6
vrk_1:	CALL    Lsb_VfdInByte
	MOV	@R0,A
	INC	R0
	DJNZ	B,vrk_1
	SETB	VFD_STB

	POP	_R
	POP	B
	RET

;-----------------------------------------------;
;Name: Lsb_InitVfd				;
;In:	 no					;
;Out:    no                                     ;
;Update: 2002/10/12				;
;check:  InitVfd			        ;
public	 Lsb_InitVfd			        ;
;-----------------------------------------------;
Lsb_InitVfd:
	PUSH	B
	PUSH	_R

	;-(1)SET DISPLAY MODE---------;
	MOV	A,#VFD_DISPLAYMOD_SEG16
	CALL	Lsb_VfdWriteCommand

	;-(2)SET DATA TYPE--------;
	MOV	A,#VFD_SET_DISPLAY
	CALL	Lsb_VfdWriteCommand

	;-(3)CLR DISPLAY-;
	CLR	VFD_STB
	MOV	A,#VFD_ADDR_FLAG OR 00H
	CALL    Lsb_VfdOutByte
	;-----------;
	MOV	R0,#gDisplayBuf
	MOV	B,#9
iv_1:	MOV	A,@R0
	CALL    Lsb_VfdOutByte

	INC	R0
	MOV	A,@R0
	CALL    Lsb_VfdOutByte

	CLR	A
	CALL    Lsb_VfdOutByte

	INC	R0     ;update 2002/10/12 add bug
	DJNZ	B,iv_1
	SETB	VFD_STB

	;-(4)DISPLAY ON----------------------;
	MOV	A,#VFD_DISPLAY_ON OR VFD_DIM14
	CALL    Lsb_VfdWriteCommand

	POP	_R
	POP	B
	RET



;-----------------------------------------------;
;Name: Lsb_PushVfdBuf				;
;In:	 no					;
;Out:    no                                     ;
;Update: 2002/10/12				;
;check:  InitVfd			        ;
extern Vw_VfdBakBuf                             ;
public	 Lsb_PushVfdBuf				;
;-----------------------------------------------;
Lsb_PushVfdBuf:
	PUSH	B
	PUSH	_R
	PUSH	_R+1

	MOV	B,#18
	MOV	R0,#Vw_VfdBakBuf
	MOV	R1,#gDisplayBuf
	CALL	Lsb_MemCpy

	POP     _R+1
	POP	_R
	POP	B
	RET


;-----------------------------------------------;
;Name: Lsb_PopVfdBuf				;
;In:	 no					;
;Out:    no                                     ;
;Update: 2002/10/12				;
;check:  InitVfd			        ;
public	 Lsb_PopVfdBuf				;
;-----------------------------------------------;
Lsb_PopVfdBuf:
	PUSH	B
	PUSH	_R
	PUSH	_R+1

	MOV	B,#18
	MOV	R0,#gDisplayBuf
	MOV	R1,#Vw_VfdBakBuf
	CALL	Lsb_MemCpy
	CALL	Lsb_InitVfd

	POP     _R+1
	POP	_R
	POP	B
	RET

;-----------------------------------------------;
;Name: Lsb_MemCpy				;
;In:	 (1)count=B				;
;        (2)R1=src                              ;
;	 (3)R0=dest                             ;
;Out:    no                                     ;
;Update: 2002/10/12				;
;check:  InitVfd			        ;
;-----------------------------------------------;
Lsb_MemCpy:
mcp_1:	MOV	A,@R1
	MOV	@R0,A
	INC	R0
	INC	R1
	DJNZ	B,mcp_1
	RET





;---------------------------------------------------------------------------;
	END


⌨️ 快捷键说明

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