:::

論壇索引


Board index » All Posts (國偉)




Re: 想請問ㄧ下關於APP001上的LCD
#21
初級會員
初級會員


看W401....裡EX4
void LCD_ItoA(unsigned int AD_Data)..這行看不明白
是指A/D後的2^10=1024所以AD_Data/1000嗎...
{

DS_Zero_FLG=1;.......指LCD有接收資料嗎??
putcLCD(Set_BCD_ASCII(AD_Data/1000)); // 顯示千位數
AD_Temp=AD_Temp%1000; // 取出百位以後的數

putcLCD(Set_BCD_ASCII(AD_Temp/100)); // 顯示百位數
AD_Temp=AD_Temp%100;

putcLCD(Set_BCD_ASCII(AD_Temp/10)); // 顯示十位數
AD_Temp=AD_Temp%10;

putcLCD(AD_Temp+='0'); // 顯示個位數
}
下面的意思是說BCD碼轉ASCI嗎...
unsigned char Set_BCD_ASCII(unsigned char BCD_Data)
{
if (BCD_Data==0)
{
if (DS_Zero_FLG) return ' '; // 居先零抑制
else return '0'; // 顯示一般的零
}
else
{
DS_Zero_FLG=0; // 取消居先零的抑制
return (BCD_Data +='0'); // 並傳回 ASCII Code
}
}
2

發表於: 2006/5/7 0:05
頂部


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


想讓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
頂部


Re: Read VR1 with the analog voltage input and convert the voltage
#23
初級會員
初級會員


1.可以舉例a/d 轉ascii 嗎
2.CBLOCK 0x00.......這行意思是什麼呢...
C_Hold_Delay ; variable used for the sample hold charge time
TxD_Flag ; 500mS time flag, Send TxD data to Terminal
Hex_Temp
ENDC......使用巨集嗎?

不知去那查
請版主教一下
謝謝!!

發表於: 2006/4/27 20:42
頂部


Read VR1 with the analog voltage input and convert the voltage
#24
初級會員
初級會員


Conver A/D <b9:b8> to ASCII\\????
movf ADRESH,W
andlw b'00000011'
call Hex_ASCII
call Tx_a_Byte
Conver A/D <b7:b4> to ASCII?????
swapf ADRESL,W.......為什麼用swapf 乘h'0F' andlw h'0F'
call Hex_ASCII
call Tx_a_Byte
movf ADRESL,W .....Conver A/D <b3:b0> andlw h'0F'
call Hex_ASCII
call Tx_a_Byte
這是W400課程裡EX4範例.....看不明白所以想請問大家謝謝

發表於: 2006/4/27 2:36
頂部


Re: lcd 上顯示跑馬燈程式??
#25
初級會員
初級會員


你好
謝謝
你說的16fc52我專科有教一點..但沒教到lcd...

我讀夜二技中華電子....說不定你女友我認識喔...
我們老師用
pic18fxx2教
..

發表於: 2006/4/20 21:50
頂部


Re: lcd 上顯示跑馬燈程式??
#26
初級會員
初級會員


謝謝你
那我想再請問想讓lcd 顯示文字出來
但下面的程式看的很模糊
可以去那找資料看嗎?? 我真的想學好PIC
謝謝
LCD_Start:
call LCD_Initial
movlw 0xc0
call LCD_Set_DDA //游標位置
clrf Lower_Ptr,0--------?????
movlw 0x10
movwf Address_Counter,0 位址計數嗎??

Display_Lower:
call Message_Lower_Table
call LCD_Put_Char //顯示字元
incf Lower_Ptr,F,0
incf Lower_Ptr,F,0 為什麼增加兩次ㄚ?
decfsz Address_Counter,F,0
goto Display_Lower

clrf Upper_Shift,0
Display_Upper:
clrf Upper_Ptr,0
movlw 0x10
movwf Address_Counter,0
movlw 0x80
call LCD_Set_DDA
movf Upper_Shift,W,0
addwf Upper_Ptr,F,0
Upper_Loop:
call Message_Upper_Table
call LCD_Put_Char
incf Upper_Ptr,F,0
incf Upper_Ptr,F,0
movf Upper_Ptr,W,0
sublw (Welcome_End_StringWelcome_String)
btfsc STATUS,Z,0
clrf Upper_Ptr,0
decfsz Address_Counter,F,0
goto Upper_Loop
incf Upper_Shift,F,0
incf Upper_Shift,F,0
movf Upper_Shift,W,0
sublw (Welcome_End_String-Welcome_String)
btfsc STATUS,Z,0
clrf Upper_Shift,0
goto Display_Upper

;***************************************************
;**************** Message upper table **************
;***************************************************
Message_Upper_Table:
movlw high Message_Upper_Table
movwf PCLATH,0
movlw low Message_Upper_Table
sublw low Welcome_String
btfss STATUS,C,0
incf PCLATH,F,0
movlw low Welcome_String
addwf Upper_Ptr,W,1
btfsc STATUS,C,0
incf PCLATH,F,0
movwf PCL,0
Welcome_String: dt "LCD program test ^_^ ! "
Welcome_End_String:

;***************************************************
;**************** Message lower table **************
;***************************************************
Message_Lower_Table:
movlw high Message_Lower_Table
movwf PCLATH,0 .....??
movlw low Message_Lower_Table ????
sublw low Index_String
btfss STATUS,C,0
incf PCLATH,F,0
movlw low Index_String
addwf Lower_Ptr,W,1
btfsc STATUS,C,0
incf PCLATH,F,0
movwf PCL,0
Index_String: dt " DR3.Studio "


end

發表於: 2006/4/19 20:37
頂部


lcd 上顯示跑馬燈程式??
#27
初級會員
初級會員


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    TRISB
,0        //portb 為輸出
    
movlw    0xf8.......?     不明白這用意何在
    andwf    TRISE
,F,0....?  不明白這用意何在
    clrf    LATB
,0
    clrf    LATE
,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

發表於: 2006/4/18 23:44
頂部



« 1 2 (3)



:::

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... ]

教育訓練中心

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