View previous topic :: View next topic |
Author |
Message |
vinodkumar
Joined: 18 Oct 2005 Posts: 7 Location: Jabalpur
|
Posted: Tue Dec 13, 2005 7:15 pm Post subject: need clarifications |
|
|
IF i declare the folowing bit variables as
Do
T1 = P2.2
T2 = P2.3
T3 = P2.4
'some code
Gosub Switch
Loop
End
'Press buttons routine
Switch:
Debounce T1 , 0 , Stevec1 , Sub 'UP
Debounce T2 , 0 , Mod , Sub 'DOWN
Debounce T3 , 0 , Stevec , Sub 'MODE
End If
Return
Do i get the real values of the Ports debounced or the T1, T2, T3. will this be reliable in sensing a switch closure |
|
Back to top |
|
|
vasan
Joined: 21 Jun 2004 Posts: 13 Location: Chennai
|
Posted: Thu Dec 15, 2005 10:07 am Post subject: Key Scanning |
|
|
You can do like this:
T1 Alias P2.2
T2 Alias P2.3
T3 Alias P2.4
'Do not include the above in the loop
Do
'some code
Gosub Switch
Loop
End
'Press buttons routine
Switch:
Debounce T1 , 0 , Stevec1 , Sub 'UP
Debounce T2 , 0 , Mod , Sub 'DOWN
Debounce T3 , 0 , Stevec , Sub 'MODE
End If
Return
' This should work basically. But if you need to wait until the key 'is 'released then see the application notes of mcs elec where you can find an excellent program. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|