bypass time separate serin

Vroom

Member
How continuing time like for b1 = 1 to 40, but through serin, so bypass the serin then other command and then next b1 to back pass serin?
 

BeanieBots

Moderator
I think this the classic issue with serin hang when no serin is received.
The trick is to not enter serin until data is available.
This has been covered many times. One option is to use interrupts or handshaking. Alternatively, use a 28X1 which has serin timeout.
 

Vroom

Member
Yes, I see I understand that serin is hang when no serin is received so impossible serin timeout or byspass until receive data available only, DAMN!!! Really use a 28X1 which has serin timeout that possible serin timeout when no data available and then bypass the serin then next other command, its great, I will buy 28X1, how make command serin timeout so put time pause right?

Cheers, Andy
 

BeanieBots

Moderator
It's explained in the manual.
You must set a timeout value and an address (label) which tells the command where to jump to when the timeout happens.
By including a pause which is similar to the timeout value in the "data received" section of your code, you can maintain a reasonably constant itteration rate for your loop irrespective of data or not.
 

Vroom

Member
Use 28X1 how make command for timeout from serin when not receive data available? Im saying about 500ms timeout then other command, and then back serin after same 500ms.
 

BeanieBots

Moderator
Which part of page 154 manual 2 "serin" are you having a problem with?
SERIN [timeout,address], pin,baudmode,(qualifier...),{#}variable,{#}variable
 

manie

Senior Member
I see a possible language problem here.

Vroom: Like Inglewoodpete said: "slow down some laddy...". Read the serin command from left to right....

The square brackets "[" and "]" indicates that this enclosed part is optional, may use it or may leave it out. You want to use it so your command will look something like this:
Serin 500,CheckData,x,N4800_4,"ABC",b0

CheckData:
....some code here
where the "500" says "wait for 500ms for data, if there is nothing then goto CheckData and do what must happen if no data comming in... OK ?
Manie
 

hippy

Ex-Staff (retired)
The square brackets indicating "optional" caught me out when they first appeared as I made assumptions which were not valid. The timeout is optional - the list of commands shows the alternatives available - but if the timeout is used it must enclosed by square brackets. So ...

Serin [500,CheckData],x,N4800_4,"ABC",b0
 

Dippy

Moderator
I've seen many people get confused by this... including me.

I notice a couple of other BASIC Editors/IDEs have a similar format when explaining the syntax i.e. options and brackets all over the place.
However, the other Editors/IDEs actually provide written examples in their Helps to clear up ambiguity.

Just an extra line or two , showing examples, in the BASIC Manual would help people over the hurdles for Serin and one or two others things as well.
Get typing hippy ;)
 

manie

Senior Member
Whooops ! Sorry Vroom, I left out the "[" in my example code... Hippy's code example is absolutely correct. Thanks for correcting me Hippy...
Manie
 
Top