Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

How to cancel user data input ?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
CrazyIgels

Bascom Member



Joined: 26 Oct 2007
Posts: 79

russia.gif
PostPosted: Wed Jan 16, 2008 8:59 am    Post subject: How to cancel user data input ? Reply with quote

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
View user's profile
Luciano

Bascom Member



Joined: 29 Nov 2004
Posts: 3149
Location: Italy

blank.gif
PostPosted: Wed Jan 16, 2008 9:24 am    Post subject: Reply with quote

Hi,

See Bascom help file $TIMEOUT. (Must use hardware USART).

Best regards,

Luciano
Back to top
View user's profile
CrazyIgels

Bascom Member



Joined: 26 Oct 2007
Posts: 79

russia.gif
PostPosted: Wed Jan 16, 2008 10:07 am    Post subject: Reply with quote

Thanks!!!
All working good.
Back to top
View user's profile
subar

Bascom Member



Joined: 31 May 2007
Posts: 142
Location: kurdistan region

blank.gif
PostPosted: Wed Jan 16, 2008 9:21 pm    Post subject: Reply with quote

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
View user's profile Yahoo Messenger
CrazyIgels

Bascom Member



Joined: 26 Oct 2007
Posts: 79

russia.gif
PostPosted: Thu Jan 17, 2008 8:44 am    Post subject: Reply with quote

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
View user's profile
Arera

Bascom Member



Joined: 23 Sep 2007
Posts: 386
Location: Wuppertal, Germany

germany.gif
PostPosted: Thu Jan 17, 2008 2:03 pm    Post subject: Reply with quote

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
View user's profile
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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