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燈, 水草

請輸入看板名稱,例如:iOS站內搜尋

TOP