Torquewrench
08-23-2005, 09:50 AM
I'm using a modified version of the menu software from NV51 except with direct inputs, and I cannot seem to get the buttons to work. Here are the relevant excerpts from my code and my whole code is attached. Can anyone see the problem?
Thank you,
Phil
' Stamp (Function) Connection
' --------------------- -----
' pin 1 SOUT J1:6
' pin 2 SIN J1:5
' pin 3 ATN J1:4
' pin 4 VSS J1:3
' pin 5 P0 broken
' pin 6 P1 J1:2 Tourney Lock
' pin 7 P2 open
' pin 8 P3 J3:5 Trigger
' pin 9 P4 J3:3 Safety
' pin 10 P5 J3:1 Valve
' pin 11 P6 J2:9 Mode
' pin 12 P7 J2:7 Select
' pin 13 P8 open
' pin 14 P9 open
' pin 15 P10 J2:6 E
' pin 16 P11 J2:5 RS
' pin 17 P12 J2:4 DB4
' pin 18 P13 J2:3 DB5
' pin 19 P14 J2:2 DB6
' pin 20 P15 J2:1 DB7
' pin 21 Vdd +5V out
' pin 22 RES open
' pin 23 Vss Ground
' pin 24 Vin +9V in
'Constants
Trig_Swt CON 3 ' Trigger switch
Safe_Swt CON %00010000 ' Safety switch
Key_Mode CON %01000000 ' Mode Button
Key_Sel CON %10000000 ' Select Button
E CON 10 ' LCD Enable pin (1 = enabled)
RS CON 11 ' Register Select (1 = char)
'Variables
key VAR Byte ' button/switch input variable
key_In VAR INL ' shoes state of input buttons
Init:
DIRS = %1111110000100000 ' defines outputs, 1 = output
OUTS = $0000 ' clear the pins (hex $0000 is equivalent to %0000000000000000
GetKey:
key = %11010000 ' assume all pressed
FOR loop = 1 TO 5 ' test five times
key = key & ~key_In ' test against new input
PAUSE 5 ' wait 5 ms between tests
NEXT
RETURN
Thank you,
Phil
' Stamp (Function) Connection
' --------------------- -----
' pin 1 SOUT J1:6
' pin 2 SIN J1:5
' pin 3 ATN J1:4
' pin 4 VSS J1:3
' pin 5 P0 broken
' pin 6 P1 J1:2 Tourney Lock
' pin 7 P2 open
' pin 8 P3 J3:5 Trigger
' pin 9 P4 J3:3 Safety
' pin 10 P5 J3:1 Valve
' pin 11 P6 J2:9 Mode
' pin 12 P7 J2:7 Select
' pin 13 P8 open
' pin 14 P9 open
' pin 15 P10 J2:6 E
' pin 16 P11 J2:5 RS
' pin 17 P12 J2:4 DB4
' pin 18 P13 J2:3 DB5
' pin 19 P14 J2:2 DB6
' pin 20 P15 J2:1 DB7
' pin 21 Vdd +5V out
' pin 22 RES open
' pin 23 Vss Ground
' pin 24 Vin +9V in
'Constants
Trig_Swt CON 3 ' Trigger switch
Safe_Swt CON %00010000 ' Safety switch
Key_Mode CON %01000000 ' Mode Button
Key_Sel CON %10000000 ' Select Button
E CON 10 ' LCD Enable pin (1 = enabled)
RS CON 11 ' Register Select (1 = char)
'Variables
key VAR Byte ' button/switch input variable
key_In VAR INL ' shoes state of input buttons
Init:
DIRS = %1111110000100000 ' defines outputs, 1 = output
OUTS = $0000 ' clear the pins (hex $0000 is equivalent to %0000000000000000
GetKey:
key = %11010000 ' assume all pressed
FOR loop = 1 TO 5 ' test five times
key = key & ~key_In ' test against new input
PAUSE 5 ' wait 5 ms between tests
NEXT
RETURN