Pic Basic Pro "inkey" command

Status
Not open for further replies.

Beefer3

New Member
Hello everyone
Has anyone had any experience with using the Pic Basic Pro command "inkey". I have wired the keypad according to the example in the help files with the exception of using port c. When I power my circuit all I get is 16 across my display. When I push a button I get nothing but 16. Here is my code:

device = 16f877a
xtal = 4
declare keypad_port portc

keyin:
DIM VAR1 as BYTE
VAR1 = INKEY ' Scan the keypad
DELAYMS 50 ' Debounce by waiting 50ms
PRINT @VAR1 , " " ' Display the result on the LCD
goto keyin
end


Any help would be appreciated.
Thanks
 

I'm not familiar with PIC BASIC Pro, but do you have pull-up resistors on your input lines?. PortB has them internally (and selectable in the software), with PortC you would need to add external ones.
 
Hey Nigel, yes I have pull ups on port c. It's funny you responded, I am trying to use your code (tutorial 9) right now!!! I have to rearrange my board but hopefully it will work.
 
Beefer3 said:
Hey Nigel, yes I have pull ups on port c. It's funny you responded, I am trying to use your code (tutorial 9) right now!!! I have to rearrange my board but hopefully it will work.

Have fun
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…