PDA

View Full Version : completely incompetent



docwisdom
- 10th February 2006, 18:04
so for a while I was sitting here trying to get my lcd to read out properly. no luck in that. so now I have moved on to reading buttons, and I cant even get that to work. There must be some fundamental PBP thing that I am just not getting. here is my code. the button is wired to make the pin go high when pressed. I have a 4.7k resistor on the pin side.




B0 Var Byte

B0 = 0 ' Zero Button working buffer
pause 10

loop:
BUTTON porta.1,1,255,0,B0,0,notp ' Check button
pause 10
high portc.4
goto loop

notp:
low portc.4
pause 10
Goto loop ' Do it forever

Dwayne
- 10th February 2006, 20:16
Your Pause 10 is only for 10 milliseconds!


Try something a little longer....like Pause 1000 for 1 second.



Dwayne

Bruce
- 10th February 2006, 21:07
What PIC are you using?

If PortA is analog you'll need to disable A/D on RA1 to use it for digital input.