• 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: [怪事]用PIC16C65B的PORTC玩LCD
#3
新會員
新會員


查看用戶資訊
謝謝版大的解釋

我會試試看的


發表於: 2005/11/18 16:41
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: [怪事]用PIC16C65B的PORTC玩LCD
#2
版主
版主


查看用戶資訊
有可能是 Read-Modify-Write 的問題,建議在對同一的 PORT 連續動作時加個 NOP 指令如下所示:

bsf PORTD,RS
nop
bcf PORTD,RW
nop
bcf PORTD,E
nop

你也可以參考右邊"範例程式"裡的 HD44780 LCD 控制程式。

發表於: 2005/11/18 12:02
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


[怪事]用PIC16C65B的PORTC玩LCD
#1
新會員
新會員


查看用戶資訊
TO 版大

小弟我最近玩PIC16C68B時發現一件怪事
我將PORTC 8腳規劃為至LCD DB7:0的輸出
但卻會有POST錯字的問題
我的LCD是相容HT44780規格的

例如:我把十六進的數值h'78'給PORTC
按理說在LCD上應出現x(小寫)
但LCD出現的卻是\(上斜線,相當於h'60')
但如果把PORTC換成PORTB就沒有這個問題

以下是我的source code
list      p=16c65b            ;
    
#include <p16c65b.inc>
;*********USER REGISTER***********
S_1ms    EQU    H'10'
S_10us    EQU    H'11'
S_05s    EQU    H'12'
S_40us    EQU    H'13'
RCSTK    EQU    H'14'    
temp    EQU    H'15'
;***** VARIABLE DEFINITIONS*******
;
RD'
RS    EQU    H'
01'
RW    EQU    H'
02'
E    EQU    H'
03'
;*****************************            ORG         0x00             ; 
    goto    START
;******************
START                    banksel            TRISC
    movlw            h'
00'
    movwf            TRISD
    movwf            TRISB
    banksel            INTCON
SETLCD            
    movlw            h'
30'
    call            LCDSET
    movlw            h'
30'
    call            LCDSET
    movlw            h'
30'
    call            LCDSET
    movlw            h'
3c'
    call            LCDSET
;
                movlw                          h'
08'
    call            LCDSET    
    movlw            h'
0f'    
    call            LCDSET
    movlw            h'
01'    
    call            LCDSET
    movlw            h'
06'    
    call            LCDSET
PRINTER
                movlw                                    h'
78'
                movwf                                     RCSTK
                call                                    DISPLAY    
LCDSET            
                bcf                        PORTD,RS
    bcf            PORTD,RW
    bcf            PORTD,E
    nop
    bsf                        PORTD,E
    movwf            PORTC
    call            DELAY5MS
    bcf                        PORTD,E
    call            DELAY5MS    return        
DISPLAY            
    movwf            RBSTK
    bsf                        PORTD,RS
    bcf            PORTD,RW
    bcf                        PORTD,E
    nop
    bsf            PORTD,E
    movf            RCSTK,W
    movwf            PORTC
    call            DELAY5MS
    bcf                        PORTD,E
    call            DELAY5MS
    return    
;---------------DELAY Subroutine------------
;5ms    DELAY--        
DELAY5MS        
    movlw            d'
50'
    movwf            S_1ms
D5M_1    movlw            d'
100'
    movwf            S_10us
D5M_C    nop
    decfsz            S_10us,f
    goto            D5M_C
    decfsz            S_1ms,f
    goto            D5M_1
    return
;1ms    DELAY--
DELAY1MS
    movlw            d'
10'
    movwf            S_1ms
D1M_1    movlw            d'
100'
    movwf            S_10us
D1M_C    nop
    decfsz            S_10us,f
    goto            D1M_C
    decfsz            S_1ms,f
    goto            D1M_1
    return
;100us    DELAY--        
DELAY100uS        
    movlw            d'
100'
    movwf            S_1ms
D100u_C    nop
    decfsz            S_10us,f
    goto            D43M_C
    return
;40 uS  DELAY--
DELAY40uS
    movlw            d'
40'
    movwf            S_40us
D4U_C    nop
    decfsz            S_40us,f
    goto            D4U_C
    return
    END



以上 , 請麻煩版大能替我解釋一下 謝謝

發表於: 2005/11/17 14:28
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... ]

教育訓練中心

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