ASM 板


LINE

看板 ASM  RSS
请问一下 我的程式码在APP01上的一行LCD上可以显示,但最近换了一个四行的LCD,加了程式码却 只能显示2行,不知道是哪里的设定有问题?可以麻烦帮我看一下吗? 附加档案在文章底部(LCD Datasheet & 程式码) http://0rz.tw/NReDT ----------------------------------------- list p=18f4585 #include <p18f4585.inc> EXTERN InitLCD,putcLCD,Send_Cmd,L1homeLCD,L2homeLCD,L3homeLCD,L4homeLCD,clrLCD, PutHexLCD PUT_Address macro STR movlw UPPER STR movwf TBLPTRU movlw HIGH STR movwf TBLPTRH movlw LOW STR movwf TBLPTRL call Put_String endm start code org 0x00 bra start prog code start call InitLCD call clrLCD call L1homeLCD PUT_Address String_1 call L2homeLCD PUT_Address String_2 call L3homeLCD PUT_Address String_3 call L4homeLCD PUT_Address String_4 bra $ Put_String TBLRD*+ movlw 0x00 cpfseq TABLAT,0 bra Send_String return Send_String movf TABLAT,w,0 call putcLCD bra Put_String String_1 db "First ",0x00 String_2 db "Second",0x00 String_3 db "Third",0x00 String_4 db "Fourth",0x00 end end --------------------------------------LCD设定 list p=18f4585 #include <p18f4585.inc> global InitLCD global putcLCD global clrLCD global L1homeLCD global L2homeLCD global L3homeLCD global L4homeLCD global Send_Cmd global PutHexLCD global Hex2ASCII global Delay_xMS global Delay_1ms LCD_CTRL equ TRISD LCD_DATA equ LATD #define LCD_E_DIR TRISA,2 ;pin RA2=LCD_E #define LCD_RW_DIR TRISD,5 #define LCD_RS_DIR TRISD,4 #define LCD_E LATA,2 #define LCD_RW LATD,5 #define LCD_RS LATD,4 CLR_DISP equ b'00000001' Cursor_Home equ b'00000010' ENTRY_DEC equ b'00000100' ENTRY_DEC_S equ b'00000101' ENTRY_INC equ b'00000110' ENTRY_INC_S equ b'00000111' DISP_OFF equ b'00001000' DISP_ON equ b'00001100' DISP_ON_C equ b'00001110' DISP_ON_B equ b'00001111' FUNC_SET equ b'00101000' CG_RAM_ADDR equ b'01000000' DD_RAM_ADDR equ b'10000000' ;DD_RAM_UL equ 0x080 ; Upper Left coner of the Display UDATA LCD_Byte RES 1 LCD_Temp RES 1 Count_100us RES 1 Count_1ms RES 1 Count_ms RES 1 W_BUFR RES 1 Hex_Bfr RES 1 LCD_CODE CODE InitLCD banksel TRISD clrf TRISD clrf LATD clrf TRISA clrf LATA banksel LCD_DATA bcf LCD_E bcf LCD_RW bcf LCD_RS bcf LCD_E_DIR bcf LCD_RW_DIR bcf LCD_RS_DIR banksel LCD_DATA clrf LCD_DATA banksel ADCON1 movlw b'00001101' movwf ADCON1 banksel ADCON2 movlw b'00001011' movwf ADCON2 banksel LCD_CTRL movf LCD_CTRL,w andlw 0xF0 movwf LCD_CTRL movlw .10 ;power on delay 10ms rcall Delay_xMS movlw b'00000011' rcall Send_Low_4bit movlw .10 rcall Delay_xMS movlw b'00000011' rcall Send_Low_4bit rcall Delay_1ms movlw b'00000011' rcall Send_Low_4bit rcall Delay_1ms movlw b'00000010' rcall Send_Low_4bit rcall Delay_1ms movlw FUNC_SET rcall Send_Cmd rcall Delay_1ms movlw DISP_ON rcall Send_Cmd rcall Delay_1ms banksel CLR_DISP movlw CLR_DISP rcall Send_Cmd movlw .5 rcall Delay_xMS banksel ENTRY_INC movlw ENTRY_INC rcall Send_Cmd rcall Delay_1ms banksel DD_RAM_ADDR movlw DD_RAM_ADDR rcall Send_Cmd rcall .5 rcall Delay_xMS banksel ENTRY_INC movlw ENTRY_INC rcall Send_Cmd rcall Delay_1ms banksel DD_RAM_ADDR movlw DD_RAM_ADDR rcall Send_Cmd rcall Delay_1ms return putcLCD banksel LCD_Byte movwf LCD_Byte rcall Send_High_LCD banksel LCD_Byte movf LCD_Byte,W rcall Send_Low_LCD rcall Delay_100us return Send_High_LCD swapf WREG,W Send_Low_LCD banksel LATD bcf LCD_RW andlw 0x0F banksel LCD_Temp movwf LCD_Temp banksel LCD_DATA movf LCD_DATA,W andlw 0xF0;0x0F banksel LCD_Temp iorwf LCD_Temp,W banksel LCD_DATA movwf LCD_DATA ;DB[4:7] banksel LATD bsf LCD_RS bcf LCD_RW nop banksel LATA bsf LCD_E nop ;movlw .10 ;bra Delay_xMS bcf LCD_E return PutHexLCD banksel W_BUFR movwf W_BUFR swapf W_BUFR,W rcall Hex2ASCII rcall putcLCD banksel W_BUFR movf W_BUFR,W rcall Hex2ASCII rcall putcLCD return Hex2ASCII andlw 0xF0 banksel Hex_Bfr movwf Hex_Bfr sublw .09 banksel STATUS btfsc STATUS,C bra _Add_W_30 _Add_W_37 movlw 0x37 bra _Hex_cont _Add_W_30 movlw 0x30 _Hex_cont banksel Hex_Bfr addwf Hex_Bfr,W return Send_Cmd banksel LCD_Byte movwf LCD_Byte rcall Send_High_4bit banksel LCD_Byte movf LCD_Byte,W rcall Send_Low_4bit rcall Delay_100us return Send_High_4bit swapf WREG,W Send_Low_4bit ;bcf LCD_RW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; andlw 0x0F banksel LCD_Temp movwf LCD_Temp banksel LCD_DATA movf LCD_DATA,W andlw 0xF0 banksel LCD_Temp iorwf LCD_Temp,W banksel LCD_DATA movwf LCD_DATA ;DB[4:7] banksel LATD bcf LCD_RS bcf LCD_RW nop banksel LATA bsf LCD_E nop ;movlw .10 ;bra Delay_xMS bcf LCD_E return clrLCD banksel CLR_DISP movlw CLR_DISP rcall Send_Cmd movlw .5 bra Delay_xMS L1homeLCD banksel DD_RAM_ADDR movlw DD_RAM_ADDR|0x00 rcall Send_Cmd bra Delay_100us L2homeLCD banksel DD_RAM_ADDR movlw DD_RAM_ADDR|0x14 rcall Send_Cmd bra Delay_100us L3homeLCD banksel DD_RAM_ADDR movlw DD_RAM_ADDR|0x40 rcall Send_Cmd bra Delay_100us L4homeLCD banksel DD_RAM_ADDR movlw DD_RAM_ADDR|0x54 rcall Send_Cmd bra Delay_100us Delay_xMS banksel Count_ms movwf Count_ms _D_ms call Delay_1ms banksel Count_ms decfsz Count_ms,F goto _D_ms return Delay_1ms movlw .10 banksel Count_1ms movwf Count_1ms _D_1ms call Delay_100us banksel Count_1ms decfsz Count_1ms,f bra _D_1ms return Delay_100us movlw .50 banksel Count_100us movwf Count_100us _D_2us nop nop banksel Count_100us decfsz Count_100us,f bra _D_2us return end --



※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.44.2







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:Tech_Job站内搜寻

TOP