• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
  • slider image 488
  • slider image 491
:::


Browsing this Thread:   1 Anonymous Users






Re: 想讓APP01 板子上的LCD 有被控制到
#2
版主
版主


查看用戶資訊
不知道會不會動因為沒有時間可以幫你測試,但右邊範例程式裡有寫好的LCD範例可供參考。 範例在 13.1 裡

發表於: 2006/5/5 14:26
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


想讓APP01 板子上的LCD 有被控制到
#1
初級會員
初級會員


查看用戶資訊
想讓APP01 板子上的LCD 有被控制到下面寫的程式對嗎
l
list p=18f452,r=dec
#include p18f452.inc

;----- include variable -----
extern LCD_Temp
;----- include function -----
extern LCD_Put_Cmd,LCD_Display,LCD_Clear,LCD_Entry
;----- Code start -----
P_Code code
;----- LCD initial -----
LCD_Initial:
global LCD_Initial
clrf TRISD,0
movlw 0xf8
andwf TRISD,F,0
clrf LATD,0
clrf LATD,0
bcf INTCON2,RBPU,0

movlw 0x30
call LCD_Put_Cmd
movlw 0x30
call LCD_Put_Cmd
movlw 0x30
call LCD_Put_Cmd
movlw 0x38
call LCD_Put_Cmd
movlw 0x0e
call LCD_Display
call LCD_Clear
movlw 0x06
call LCD_Entry
return
end

;lcd command

list p=18f452,r=dec
#include p18f452.inc

;----- include variable -----
extern LCD_Temp
;----- include function -----
extern X_Delay500
;----- Code start -----
P_Code code
;******************************************
;Send command to LCD
;The command is in W
;******************************************
LCD_Put_Cmd:
global LCD_Put_Cmd
movwf LCD_Temp,0
call Check_LCD_Busy
movlw 0x04
movwf LATD,0
movff LCD_Temp,LATB
movlw 0x00
movwf LATD,0
movlw 0x1e
call X_Delay500
return

;******************************************
;****** Check LCD Busy flag ***************
;******************************************
Check_LCD_Busy:
global Check_LCD_Busy
movlw 0xff
movwf TRISD,0

Check_Flag:
movlw 0x06
movwf LATA,2
movf PORTD,W,0
andlw 0x80
btfss STATUS,Z,0
goto Check_Flag
clrf TRISD,0
return

;******************************************
;********** Display control ***************
;******************************************
LCD_Display:
global LCD_Display
andlw 0x07
iorlw 0x08
call LCD_Put_Cmd
return

;******************************************
;********** Clear LCD monitor *************
;******************************************
LCD_Clear:
global LCD_Clear
movlw 0x01
call LCD_Put_Cmd
return

;******************************************
;************ Set LCD entry ***************
;******************************************
LCD_Entry:
global LCD_Entry
andlw 0x03
iorlw 0x04
call LCD_Put_Cmd
return

;******************************************
;************* Cursor go home *************
;******************************************
LCD_Home:
global LCD_Home
movlw 0x02
call LCD_Put_Cmd
return

;******************************************
;******** Set CGRAN's address *************
;******************************************
LCD_Set_CGA:
global LCD_Set_CGA
andlw 0x3f
iorlw 0x40
call LCD_Put_Cmd
return

;******************************************
;********* Set DDRAM;s address ************
;******************************************
LCD_Set_DDA:
global LCD_Set_DDA
iorlw 0x80
call LCD_Put_Cmd
return

;******************************************
;*********** Read_LCD_Cursor **************
;******************************************
Read_LCD_Cursor:
global Read_LCD_Cursor
movlw 0xff
movwf TRISD,0
movlw 0x06
movwf LATE,0
clrf TRISD,0
movf LATD,W,0
return

;******************************************
;*********** LCD_Put_Char *****************
;******************************************
LCD_Put_Char:
global LCD_Put_Char
movwf LCD_Temp,0
call Check_LCD_Busy
movlw 0x05
movwf LATA,2
movff LCD_Temp,LATB
movlw 0x01
movwf LATD,0
movlw 0x1e
call X_Delay500
return

;******************************************

end



發表於: 2006/4/29 22:14
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------