Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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
 
Beefer3 said:
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:

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.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top