請教PIC12F629 I/O 控制問題
|
||||
---|---|---|---|---|
新會員
|
小弟在應用PIC12F629時,有遇到I/O的問題,麻煩各位大大幫忙解答一下,謝謝!
問題: 利用GPIO1 為Input,其他GPIO為Output,那在Input腳用 Jmp當開關做為HI/LO Input Select,那我的Source Code如下但是Run了之後去切換Input的狀態但是輸出GPIO0都不會改變狀態,請問要怎麼解決? Code: LIST P=12f629 #include <P12F629.inc> ORG 00H NOP MainLine CALL Inital Loop BCF STATUS,RP0 BTFSC GPIO,1 GOTO LEDon GOTO LEDoff LEDon BCF STATUS,RP0 BSF GPIO,0 GOTO Loop LEDoff BCF STATUS,RP0 BCF GPIO,0 GOTO Loop Inital BSF STATUS,RP0 ;; set poweron reset BCF PCON,NOT_POR BCF STATUS,RP0 ;; set GPIO Digital I/O CLRF GPIO MOVLW 07H MOVWF CMCON BSF STATUS,RP0 ;; Set GPIO1 In Others out MOVLW B'00000010' MOVWF TRISIO BCF STATUS,RP0 RETURN Over END 謝謝大大的指導,已經可以動作了,但是現在還有一個小問題 就是我用示波器去量波形,但是波形的輸出是連續方波這樣子是正常的嗎?這是不是代表IC在讀GPIO狀態時會把輸出的波形拉到LOW然後再輸出?
發表於: 2008/2/19 14:46
|
|||
|