Comunication COM1: and a CNC milling machine (timeout?)

Dar Scott dsc at swcp.com
Wed Sep 17 13:48:01 EDT 2003


On Wednesday, September 17, 2003, at 04:54 AM, Malte Brill wrote:

> When I hit the button, it instantly reports EOF in fld "fehler".
> How do I tell Revolution to wait until the data is sent by the CNC 
> milling
> machine? Can I set a timeout somehow to wait let´s say for about 2 
> minutes?

You are on the right track.

For a quick test, add a second delay before the read.

Also, for your testing you might want to replace numToChar(13) with 
"<cr>" and numToChar(10) with "<lf>" to make sure you understand what 
data you are really getting.

In your real code, experiment with either timeout or with end-of-line 
detection.  You can try these with the read options or build them 
yourself.  I do the latter.

The 'eof' in result simply means you got to the current end of buffer.

I usually write serial I/O to 'read until empty' regularly and thus 
would get 'eof' every time.  I usually use a send timer, but a repeat 
with read and a short should work--try that first.  My code accumulates 
my read values until it gets the data I want or until it gives up.  I 
would put the 2 minute check in this loop.

I wish you the best.  Would you be willing to let us know how this 
works out?

Dar Scott

****************************************
     Dar Scott Consulting
     http://www.swcp.com/dsc/
     Programming Services
****************************************



More information about the use-livecode mailing list