From: Emad Ktifany on
Hi.

I am trying to read data from a laser sensor and send G_Code to a
CNC at the sane time. I used Real Time Windows Target for reading data
throug an ADVANTECH PCI card, and used an m-file to create an RS232
object. This m-file leads both operations. It worked perfectly for a
bout 20 lines of G-Code and then the CNC stoped working and gave an
alarm of connection error. while the reading data from sensor
continued to work correctly.

I do not know what could be the problem. How is it possible to be
connection error while MATLAB started to send data to CNC and it
started to receive data (as i said 20 line of G-code). The CNC
receives G-code from the same port though a DNC program and it has no
problem then.

This is the code i am using to send G_code:

fprintf(CNC,sprintf('%s %.9f %s %.9f','G00 x',X0,' y',Y0))

Where CNC is the RS232 object, X0 andY0 are coordinates values.

Could i get some help about this please.

Thank you all.