BasicMicro - Forums

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

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: HSERIN Timeout
PostPosted: Sat May 26, 2007 10:00 pm 
I've searched, but not found, anything specific to this. So, forgive me if it has already been covered.

It seems to me that what's being called a "timeout" with HSERIN is actually a delay before a jump to the "timeout label" regardless of the state of the receive buffer. If the buffer is empty, it looks like a timeout, but if the data is there, it gets it, waits the specified period, then jumps to the specified label.

In other words,

...

HSERSTAT 0
Main
...
GOSUB GetGPS
...
END

GetGPS
HSERSTAT 4, GetGPS
HSERIN NoData, 1000, [WAIT("@"),STR GPSStr5413]
...
HSERSTAT 0
Return

NoData
...
GOTO Main

always results in a jump to "NoData" after 1 second even though the string was retreived and assigned to "GPSStr".

Can anyone confirm this or show me where I'm going wrong?

Thanks,
Don


Top
  
 
 Post subject: Re: HSERIN Timeout
PostPosted: Sun May 27, 2007 10:00 pm 
Offline
Citizen

Joined: Sat Mar 08, 2003 11:00 am
Posts: 40
Well, for one thing, you're "got good data" is a "Return", while your "timeout" is a "GOTO". This will over-run the subroutine return stack very quickly.

Also, you have a 'WAIT' parameter, as well as "looking for character 13" parameter, as well as "54 characters" clause. I wasn't aware that HSERIN supported all those parameters.


Top
 Profile  
 
 Post subject: Re: HSERIN Timeout
PostPosted: Mon May 28, 2007 8:48 am 
Oops. That was a typo. I didn't really do that in the code.

Well, the book says that HSERIN is similar to SERIN and refers the reader to the SERIN section for more information. It doesn't give much (any?) meaningful info under HSERIN, like no mention of the timeout. I can't say with certainty, but I'm pretty sure that the "WAIT", "# of characters", and "13" parameters work. Certainly, they don't generate any compiler errors.

Seems like there is a lot of confusion about HSERIN on this forum. I was hoping someone from tech support could step in and give an accurate discription of its operation.


Top
  
 
 Post subject: Re: HSERIN Timeout
PostPosted: Mon May 28, 2007 9:32 am 
I had a brainstorm and downloaded the MBasic manual. Here's what it says:

HSERIN..HSEROUT
SETHSERIAL mode
HSERIN {label,timeout,}[InputData]
HSEROUT [InputData]

Receive and Send Asynchronous RS-232 data.

label,Timeout(optional) is a label that will be jumped to if the hserin
buffer has no data available in the buffer and the timeout period has
expired. If a timeout is not defined the hserin command will wait
indefinitely while the uart receive buffer is empty.

InputData can be a list of variables and or modifiers that tell
HSERIN / HSEROUT what to do when sending or receiving data.

All the modifiers supported by SERIN and SEROUT are supported
by HSERIN and HSEROUT.


Is it safe to assume that this also applies to the Atom?


Top
  
 
 Post subject: Re: HSERIN Timeout
PostPosted: Mon May 28, 2007 10:00 pm 
Offline
Citizen

Joined: Sat Mar 08, 2003 11:00 am
Posts: 40
Yup, it's safe to assume that.

Which still leaves the issue -- why is it timing out every time?

I'm betting it wants the CHR(13), and it's not getting it.


Top
 Profile  
 
 Post subject: Re: HSERIN Timeout
PostPosted: Mon May 28, 2007 10:00 pm 
I bet you're right! That's easy enough to test. I'll let you know.


Top
  
 
 Post subject: Re: HSERIN Timeout
PostPosted: Thu May 31, 2007 10:00 pm 
No, it isn't the CHR(13) after all. I took it out and it's still the same. I even took out the "wait", to no avail. The thing is, I can live with it. In fact, it's a nice way to generate a delay.


Top
  
 
 Post subject: Re: HSERIN Timeout
PostPosted: Fri Jun 01, 2007 10:00 pm 
Offline
Citizen

Joined: Sat Mar 08, 2003 11:00 am
Posts: 40
You misunderstand -- if you took the "13" off, it would wait for 54 characters, and timeout. If you're not even SENDING a "CR" from VB (or whatever), THEN the "13" clause won't activate, and it will timeout.


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

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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