Hello Guest it is March 28, 2024, 07:49:15 PM

Author Topic: serial connection  (Read 4144 times)

0 Members and 1 Guest are viewing this topic.

serial connection
« on: April 06, 2006, 05:32:51 PM »
Hello, i have the following question
is there a way to control mach2 or 3 from a serial line.
What i need is that, if another computer that sends something like X200 Y200 over a serial line
mach has to move it's axes to that position and then send a reply-string  "IP" and asci 13,10
The second part is possible with the sendserial command, but continiously scanning the serial port or waiting for an event wich
announces serial data, is something else
I could use the 'getportbyte'  functions, but i'm hoping if there is a simpler way (less critical)
I can also set a port an use an oemtrigger to put mach in this 'scanning or waiting' state.
Has anyone had experience with something like this?
Thanks in advance.
Logic takes you from A to B, imagination takes you anywhere

Offline ART

*
  • *
  •  1,702 1,702
  • Tough as soggy paper.
    • View Profile
Re: serial connection
« Reply #1 on: April 06, 2006, 06:44:07 PM »
Hi:

 In theory, quite possibel using the "Event driven serial" mode. Its call GetFiFoEntry returns the last recieved line. A macro pump could look at this line and determine if a Gcode command has come in, if it has, execute it, wait till done, and send the responce. You may find quite learnign curve on doign this though.. But it is possibel in theory..

Art
Re: serial connection
« Reply #2 on: April 07, 2006, 01:44:10 PM »
Hello,
Thank you for the quick reply!
Did some testing in the mean time, first results are promissing!!! (how is 'promissing' spelled?? Me from Belgium)
also had some CRLF problems like some other people on the forum encountered.
that's solved, but the command 'SendSerial' doesn't seem to work.
if i call the routine, the system hangs.
I probably need to use some command with 'fifo' in it that i don't know about.

Hope someone can help here ...
... will keep searching the forums ...

Thanks, Kris.
Logic takes you from A to B, imagination takes you anywhere
Re: serial connection
« Reply #3 on: April 07, 2006, 02:15:31 PM »
Hello,

Seems i found it on the yahoo-forum.
according to the thread (nr 52972) i need to use sendFiFO(mystringtosend).
i'll test it on monday (away for the weekend).
Don't know however, what the difference is in using GetFifoEntry() and GetFiFo().
Using the former.

Greetz.
Logic takes you from A to B, imagination takes you anywhere

Offline ART

*
  • *
  •  1,702 1,702
  • Tough as soggy paper.
    • View Profile
Re: serial connection
« Reply #4 on: April 07, 2006, 03:43:15 PM »
Hi:

 GetFifoEntry is the proper call. You cannot use SendSerial when using event driven serial support. Event driven means the thread is automatyically storing results. The CR is used as an end of line character, but you can also type in a deciaml number of a keycode to use as a delimiter. Soon a time based delimiter will also be available..

Thanks
Art
Re: serial connection
« Reply #5 on: April 10, 2006, 02:26:54 AM »
hey Art,

Works like a charm!
I can send en receive, make Mach do what i want!
It's great.
Now i'll start on the OEMtrigger to start my macro and do some testing on that.

Thanks for the help!

Greetz, Kris.
Logic takes you from A to B, imagination takes you anywhere