View previous topic :: View next topic |
Author |
Message |
CrazyIgels
Joined: 26 Oct 2007 Posts: 79
|
Posted: Wed Jan 16, 2008 8:59 am Post subject: How to cancel user data input ? |
|
|
Hello ALL!
In my project i need get some data from user.
I use input command:
INPUT "FIRST DATA", A
and if user not enter data at 5 second i must cancel input and go to main sequence of programm.
How i can do this?
I try use TIMER0 as timer:
Config Timer0 = Timer , Prescale = 1024
and on timer interrupt:
Tim0_isr:
Cycle_count = Cycle_count + 1
If Cycle_count > 100 Then
Cycle_count = 0
Print
Print "Time out - use old setting"
Goto Go2main 'this is goto to main sequence
End If
Return
but something wrong - after some seconds i can enter any data in terminal window and all software - stopped...
Please help.
Sorry my bad english. |
|
Back to top |
|
|
Luciano
Joined: 29 Nov 2004 Posts: 3149 Location: Italy
|
Posted: Wed Jan 16, 2008 9:24 am Post subject: |
|
|
Hi,
See Bascom help file $TIMEOUT. (Must use hardware USART).
Best regards,
Luciano |
|
Back to top |
|
|
CrazyIgels
Joined: 26 Oct 2007 Posts: 79
|
Posted: Wed Jan 16, 2008 10:07 am Post subject: |
|
|
Thanks!!!
All working good. |
|
Back to top |
|
|
subar
Joined: 31 May 2007 Posts: 142 Location: kurdistan region
|
Posted: Wed Jan 16, 2008 9:21 pm Post subject: |
|
|
Hi Sir
i want to know the answer for the same quistion please can you send it me please this is my email : omer_kucher@yahoo.com _________________ many people know what to do,But few people do what they know.
Regards
subar |
|
Back to top |
|
|
CrazyIgels
Joined: 26 Oct 2007 Posts: 79
|
Posted: Thu Jan 17, 2008 8:44 am Post subject: |
|
|
subar wrote: | Hi Sir
i want to know the answer for the same quistion please can you send it me please this is my email : omer_kucher@yahoo.com |
All simple:
$timeout = 2000000 'wait 2 second
Input "Kp=" , Kp_in 'any data to input
So if after 2 second data not entred - the value of data set to zero. |
|
Back to top |
|
|
Arera
Joined: 23 Sep 2007 Posts: 386 Location: Wuppertal, Germany
|
Posted: Thu Jan 17, 2008 2:03 pm Post subject: |
|
|
Be aware of this:
"The timeout is not in seconds or microseconds, it is a relative number. Only the speed of the oscillator has effect on the duration. And the value of the number of course."
(quoted from BASCOM-help).
2000000 timeout does not nessesarily mean 2 sec! |
|
Back to top |
|
|
|