想讓APP01 板子上的LCD 有被控制到
|
||||
---|---|---|---|---|
初級會員
![]() ![]() |
想讓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
|
||||
---|---|---|---|---|
初級會員
![]() ![]() |
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
|
||||
---|---|---|---|---|
初級會員
![]() ![]() |
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 上顯示跑馬燈程式??
|
||||
---|---|---|---|---|
初級會員
![]() ![]() |
你好
謝謝 你說的16fc52我專科有教一點..但沒教到lcd... 我讀夜二技中華電子....說不定你女友我認識喔... 我們老師用 pic18fxx2教 ..
發表於: 2006/4/20 21:50
|
|||
|
Re: lcd 上顯示跑馬燈程式??
|
||||
---|---|---|---|---|
初級會員
![]() ![]() |
謝謝你
那我想再請問想讓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 上顯示跑馬燈程式??
|
||||
---|---|---|---|---|
初級會員
![]() ![]() |
list p=18f452,r=dec
發表於: 2006/4/18 23:44
|
|||
|