Modena
- 5th November 2004, 14:45
I'm using the K8084 development board to learn how to use picbasic. The board uses the 16F627 chip with the LED's on port b and buttons on porta. The input from a button is high when pressed.
The following is the code I'm using to try and get the buttons working, but it doesn't work.
B6 var byte
button1 con 1
TRISA = 0
loop:
B6 = 0
button button1, 1, 10, 5, B6, 1, pressed
pause 100
goto loop
pressed:
TRISB = 0 ' PORTB is output
PORTB = %11111111 ' Turn ON diodes on PORTB
PAUSE 1000 ' Wait for 1 second
PORTB = $00000000 ' Turn OFF diodes on PORTB
pause 1000
goto loop
Can anyone see what is wrong.
The following is the code I'm using to try and get the buttons working, but it doesn't work.
B6 var byte
button1 con 1
TRISA = 0
loop:
B6 = 0
button button1, 1, 10, 5, B6, 1, pressed
pause 100
goto loop
pressed:
TRISB = 0 ' PORTB is output
PORTB = %11111111 ' Turn ON diodes on PORTB
PAUSE 1000 ' Wait for 1 second
PORTB = $00000000 ' Turn OFF diodes on PORTB
pause 1000
goto loop
Can anyone see what is wrong.