BasicMicro - Forums

www.basicmicro.com
It is currently Sun May 20, 2012 11:34 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Serin problem with time out options
PostPosted: Sun Jan 17, 2010 3:45 pm 
Offline
New User

Joined: Sat Dec 20, 2008 3:37 pm
Posts: 4
,I have a program that waits for serial data on pin 6 of the basic atom. The data comes about every 5 to 7 seconds and consists of 14 bytes followed by a carriage return
The following line works just fine Serin RX_in, n9600,[str med14] . RX_in is set to constant 6. and all 14 byes of data are returned as long as data flows in continously every 5 or seconds. However the program will hang forever unless data is recieved SO I changed the line to read Serin RX_in,n9600,15000,timeout,[str med14] to give a 15 second window for the data to show up or have the system jump to Timeout: and then go back and start at the begining hopeing that data will arrive on pin 6 on the next pass. The problem is the routine doesn't wait for 15 seconds before jumping to the Timeout: routine. SO what I am doing wrong. The chip is a 24 pin basic atom and the IDE is 05.3.1.0. It should work

Thanks Russ


Top
 Profile  
 
 Post subject: Re: Serin problem with time out options
PostPosted: Sun Jan 17, 2010 4:27 pm 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 527
Depending on what IDE you are running, I think the timeout may be in microseconds now on the Atom. So try:
RX_in,n9600,15000000,timeout,[str med14]

Kurt


Top
 Profile  
 
 Post subject: Re: Serin problem with time out options
PostPosted: Sun Jan 17, 2010 4:51 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
Hello, Russ. First, try Kurt's suggestion above.

Second, Basic Micro no longer supports the legacy compilers like 5310. You'll want to download the Studio_15 IDE/compiler from here:
http://www.basicmicro.com/BasicATOM-Downloads_ep_57-1.html
This combines all the debugged compilers from all the Atom lines. Refer to the forum manual in the Feedback section for a quick users' guide for Studio. This manual is also to be the repository for all updated commands, so keep checking back in for updates.

Third, If Kurt's suggestion works, you can ignore the rest of this and go straight to the Aus Revoir. The "timeout" value is not in milliseconds. It's in processor clocks, according to my notes, so you'll have to put a reeeallly big number in there to get 15ms! The internal clock in a 20MHz Atom is 200 nanoseconds, and each millisecond has 5000 of these. Multiply 5000 by 15000 and you get 75000000, so try that value. If your birthday comes before the timeout finishes, then they changed the internal timing after I did my notes. An alternative suggestion is to just keep multiplying the timeout value by 10 until it starts to work right. A recent post from BasicMicro suggests they are going to reveamp timings (again) and set things like this back to milliseconds.

What can I say? Not all upgrades and/or updates are helpful or go smoothly.
Get the Studio, however, it is a nice step up. And keep an eye on the forum manual.
Later.

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Serin problem with time out options
PostPosted: Tue Jan 19, 2010 12:25 pm 
Offline
New User

Joined: Sat Dec 20, 2008 3:37 pm
Posts: 4
Thanks for the help folks. the suggestion that the code was counting microseconds or clock cycles was correct. I used a value of 45535000 to get about a 10 second timeout. the IDE manual clearly state that the timeout value is a 16 bit value and is the number of milliseconds of delay to wait for data before timing out. It looks both statements are incorrect. It must have changed some where along the eveloution of the IDE and hardware. Thanks for the speedy solution Russ :D


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


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 post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO