|
|
FJC¥Ë¥å¡Ý¥¹10·î¹æ-2
;ްްްްްްްްްްްްްްްްްްްްްް
mov !rb,#00000000b ; DB7-DB0¥Ô¥ó¤òOUT¤Ë
clr ra
clr rb
clrb gie
setb txd
call init_lcd ; £Ì£Ã£Ä½é´ü²½
main mov ch,#'T' ;ŽÛ޼ŽÞޝޏŽÃŽÞްŽÀÁ÷¿®Í×µá
call transmit
call receive
mov rxdt,ch
dsp_11
clrb RS
mov rb,#10000000b+64
call write_lcd8 ; ¥«¡¼¥½¥ë¤ò£²¹ÔÌÜ¤Ë°ÜÆ°
setb RS
mov cn,#31h
dsp_2 mov rb,cn
call write_lcd8
inc cn
mov ch,rxdt
and ch,#2
call onoff
mov rb,cn
call write_lcd8
inc cn
mov ch,rxdt
and ch,#4
call onoff
mov rb,cn
call write_lcd8
inc cn
mov ch,rxdt
and ch,#8
call onoff
mov rb,cn
call write_lcd8
inc cn
mov ch,rxdt
and ch,#10h
call onoff
mov rb,cn
call write_lcd8
inc cn
mov ch,rxdt
and ch,#20h
call onoff
mov rb,cn
call write_lcd8
inc cn
mov ch,rxdt
and ch,#40h
call onoff
mov rb,cn
call write_lcd8
inc cn
mov ch,rxdt
and ch,#80h
call onoff
mov rb,cn
call write_lcd8
inc cn
mov ch,rxdt
and ch,#1
call onoff
goto main
;---------- sub ------------------
onoff cje ch,#0,offd
mov rb,#'H'
onoff1 call write_lcd8
ret
offd mov rb,#'L'
goto onoff1
; ±Õ¾½½é´ü²½¥ë¡¼¥Á¥ó
init_lcd
mov wait_cn,#15 ; wait 15ms
call wait_ms
clrb RS ; RS='L'
mov rb,#00110000b
call write_lcd8
mov wait_cn,#5 ; wait 4.1ms
call wait_ms
mov rb,#00110000b
call write_lcd8
mov wait_cn,#100 ; wait 100us
call wait_us
mov rb,#00110000b
call write_lcd8 ; 0 0 0011 (3)
mov rb,#00111000b
call write_lcd8 ; 0 0 0010 (8bit)
;
mov rb,#00001000b ; duty,font set9
call write_lcd8
mov rb,#00000001b ; ¥¯¥ê¥¢¥³¥Þ¥ó¥É
call write_lcd8
mov wait_cn,#2 ; ¥¯¥ê¥¢¤¬½ª¤ï¤ë¤Þ¤ÇÂÔ¤Ä
call wait_ms
mov rb,#00000110b ; entry mode set
call write_lcd8
mov rb,#00001110b ; display on,cursor on
call write_lcd8
ret
; £¸¥Ó¥Ã¥È¥â¡¼¥ÉÀìÍѱվ½¥é¥¤¥È¥ë¡¼¥Á¥ó
write_lcd8 nop
nop
nop
setb E ; £Å¥Ô¥ó¤ò'H'
nop
clrb E
mov wait_cn,#40
call wait_us
ret
;----------- LCD clr cursol top ---------
lcd_top clrb RS
mov rb,#00000001b ; ¥¯¥ê¥¢¥³¥Þ¥ó¥É
call write_lcd8
mov wait_cn,#2 ; ¥¯¥ê¥¢¤¬½ª¤ï¤ë¤Þ¤ÇÂÔ¤Ä
call wait_ms
mov rb,#10000000b
call write_lcd8 ; ¥«¡¼¥½¥ë¤ò£±¹ÔÌÜ¤Ë°ÜÆ°
setb RS
ret
; £í£ó¥ª¡¼¥À¡¼¤Î¥¦¥§¥¤¥È
wait_ms
wait_ms0
mov wait_cn2,#0
wait_ms1
nop
nop
nop
nop
nop
nop
nop
djnz wait_cn2,wait_ms1
djnz wait_cn,wait_ms0
ret
; ¦Ì£ó¥ª¡¼¥À¡¼¤Î¥¦¥§¥¤¥È
wait_us
wait_us0
djnz wait_cn,wait_us0
ret
; £Ò£Ó£²£³£²£ÃÁ÷¿®¥µ¥Ö¥ë¡¼¥Á¥ó
;
transmit bcf txd
mov rs,#btime
trans10 djnz rs,trans10
mov cn,#8
nop
transmit0 rr ch
nop
movb txd,c ; ¥Ç¡¼¥¿½ÐÎϡʣ̣ӣ¤«¤é¡Ë
mov rs,#btime
trans11 djnz rs,trans11
djnz cn,transmit0
nop
nop
nop
nop
nop
nop
bsf txd
mov rs,#btime
trans12 djnz rs,trans12 ; £Ó£Ô£Ï£Ð¥Ó¥Ã¥Èʬ¥¦¥§¥¤¥È
ret
; £Ò£Ó£²£³£²£Ã¼õ¿®¥µ¥Ö¥ë¡¼¥Á¥ó
receive btfss rxd
goto receive
receivew
btfsc rxd
goto receivew ; START¥Ó¥Ã¥È¤¬¤¯¤ë¤Þ¤ÇÂÔ¤Ä
mov rs,#btime/2 ; 1/2¥Ó¥Ã¥ÈʬÂÔ¤Ä
recv10 djnz rs,recv10
mov cn,#8
nop
recv0
mov rs,#btime
recv11 djnz rs,recv11
nop
movb c,rxd ; ¥Ç¡¼¥¿ÆþÎÏ
rr ch
djnz cn,recv0
ret
http://homepage2.nifty.com/JG1FJC/
|
|