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,
and used an m-file to create an RS232 object. This m-file leads both
operations. It worked perfectly for a bout 20 line of G-Code and then
the CNC stop giving 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 mainly the code i am using to send G_code:
fprintf(CNC,sprintf('%s %.9f %s %.9f','G00 x',X0,' y',Y0)); %X0 and
Y0 are coordinates values.

% and CNC is the RS232 object.