📄 lcd_tst.asm
字号:
;******************************************************************
;
; Test program for LCD driver.
;
;******************************************************************
title "LCD Driver (lcd.asm) Test"
list p=pic16f84,r=dec,n=80,x=off,st=off
include <p16f84.inc>
include <rkmacros.inc>
errorlevel -302 ; no bank warnings
clock equ 10000000 ; my crystal frequency
dusec equ 1000 ; required delay (1 mSec)
include <timer.inc> ; (note include must be after
; previous two definitions)
; Data -
cblock 0xc ; start of data area
dval
pntr
offset
endc
;****************************************************************
org 0 ; for future expansion
goto start
org 4
retfie
; All messages and the sendit/gbyt routines must be in the
; first 256 bytes of program memory.
mess1 dt 0x00,"Lat 38",0xdf,"56'42.4",0x22,0
mess2 dt 0x40,"Lng 178",0xdf,"23'19.8",0x22,0
; Send the message in program memory pointed to by W to the LCD.
sendit movwf pntr ; save pointer to data
clrf offset ; clear next byte offset
call gbyt ; get the LCD address
iorlw 0x80 ; set as address command
call lcd_c ; send command
snd1 incf offset,f ; step offset to next byte
call gbyt ; get it
iorlw 0 ; terminating null?
btfsc STATUS,Z
return ; yes, done
call lcd_d ; send to LCD data memory
goto snd1 ; around again
gbyt movf pntr,w ; get base address
addwf offset,w ; add offset
movwf PCL ; get char
;****************************************************************
; Main program begins
start clrwdt ; setup 1mSec timer
bsf STATUS,RP0
movlw b'11010000' | PRESCL ; prescaler to TMR0
movwf OPTION_REG
bcf STATUS,RP0
dotris 0,PORTA ; PORTA all outputs for now
clrf PORTA
call lcd_init ; initialise the LCD driver
movlw mess1 ; send first line
call sendit
movlw mess2 ; send second line
call sendit
loop goto loop
; Delay routine using the internal timer. Will delay for W
; times the value of "dusec" in microseconds.
delay movwf dval
dy1 clrf TMR0
bcf INTCON,T0IF
movlw TMRVAL ; set timer
movwf TMR0
dy2 btfss INTCON,T0IF ; timer overflow yet?
goto dy2 ; no
decfsz dval,f ; yes, all cycles?
goto dy1 ; no
return ; yes, delay finished
include <lcd.asm>
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -