Posted: Fri Mar 19, 2004 9:55 am Post subject: Problems with reading Input Pin
--------------------------------------------------------------------------------
Hi,
I have been up all night trying to figure out how to read an input, I have done everything that I think should be done, but nothing happens.
I have attached the code for anyone to review. I am using the PIC12F629 chip, and for some reason no matter what I do the input pins are never read.
Any help would be greatly appreciated
--------------------------------------------------------------------------------
Hi,
I have been up all night trying to figure out how to read an input, I have done everything that I think should be done, but nothing happens.
I have attached the code for anyone to review. I am using the PIC12F629 chip, and for some reason no matter what I do the input pins are never read.
Code:
STATUS Equ 0x03 ;Status Register position in Memory Map
GPIO Equ 0x05 ;General Purpose Register position in Memory Map
TRISIO Equ 0x85 ;Tris Register position in Memeory Map
WPU Equ 0x95
Bsf STATUS, 5 ;Sets Status register position 5 to 1 - Switch to bank 1
Movlw b'011110' ; Make GP0 an output
Movwf TRISIO ; moves the value above to the following location
Bcf STATUS, 5 ;Clears Status register position 5 to 0 - Switch to bank 0
Loop Btfss GPIO, 1
Goto TurnOff
Movlw b'111110'
Movwf GPIO
Goto Loop
TurnOff Movlw b'111111'
Movwf GPIO
Goto Loop
End
Any help would be greatly appreciated