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

📄 ha0002.asm

📁 LCD驱动显示可调节蜂明器频率 时钟计时显示来学习单片机
💻 ASM
字号:
include ht48r30a-1.inc
DATA_LO	EQU	02h	;to test, modify DATA_LO,DATA_HI
DATA_HI	EQU	01h

data .section 'data'
DataLo	db	?
DataHi	db	?
PageNo	db	?

mENDPAGE macro table, label
	org	0feh or (0ff00h and ($-table))
label:
	tabrdc	DataLo
	jmp	_lBackHere
endm

code .section at 0 'code'
	mov	A,DATA_LO
	mov	DataLo,A
	mov	A,DATA_HI
	mov	DataHi,A
	call	TABRD
	jmp	$

procedure .section 'code'
;---------------------------------------------------
; TABRD
; purpose: read table up to 7f00h (32512) elements
; input: 'DataHi','DataLo' as table index
; output: read data put in 'DataHi','DataLo'
; resource:
; ROM: 23 + number of data pages
; RAM: 3 ('DataHi','DataLo' and 'PageNo')
;----
TABRD proc
; PageNo=DataHi+HIBYTE[DataLo+2*(DataHi+1)]
	mov	A,DataHi
	mov	PageNo,A
	inc	PageNo
	clr	C
	rlc	PageNo
	mov	A,DataLo
	add	A,PageNo
	clr	PageNo
	sz	C
	inc	PageNo
	mov	A,DataHi
	addm	A,PageNo
; TBLP=DataLo+2*PageNo
	mov	A,PageNo
	mov	TBLP,A
	clr	C
	rlc	TBLP
	mov	A,DataLo
	addm	A,TBLP
; jump to right page and read data
	mov	A,PageNo
	addm	A,PCL
;
; insert jump's here
;
	jmp	_lPage0
	jmp	_lPage1
	jmp	_lPage2
;
;
_lBackHere:
	mov	A,TBLH
	mov	DataHi,A
	ret
TABRD endp
;----
; end of TABRD
;---------------------------------------------------
table .section page 'code'
table:
	dc	000h,001h,002h,003h,004h,005h	;max 254 elements
	mENDPAGE table,_lPage0
; fill mENDPAGE to end page data
	dc	0feh,000h,0ffh,101h,102h,213h	;max 254 elements
	mENDPAGE table,_lPage1
	dc	1fch,1fdh,1feh,1ffh,1ffh,201h
	mENDPAGE table,_lPage2
;-----
; End of largetbl.asm
;---------------------------------------------------

⌨️ 快捷键说明

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