LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can't connect to CNC machine

Hi everybody,

 

So, I'm really new with labview and I'm developing my second software, wich basically connects to a CNC machine via RS232, writes a message on its memory using Direct numerical control. The purpose of the message is to activate all of the digital outputs from a group (this is not the problem, the message is correct). The problem is that my CNC machine does not seems to be recieving the message, the code itself does not generate any errors, and when I checked on NI MAX, it seemed to be comunicating just fine.
Do any of you guys have any idea of what could be happaning?
I'm using a RS232 cable with a USB converter.

Thanks in advance!

0 Kudos
Message 1 of 7
(3,258 Views)

@leotoducz wrote:

Hi everybody,

 

So, I'm really new with labview and I'm developing my second software, wich basically connects to a CNC machine via RS232, writes a message on its memory using Direct numerical control. The purpose of the message is to activate all of the digital outputs from a group (this is not the problem, the message is correct). The problem is that my CNC machine does not seems to be recieving the message, the code itself does not generate any errors, and when I checked on NI MAX, it seemed to be comunicating just fine.
Do any of you guys have any idea of what could be happaning?
I'm using a RS232 cable with a USB converter.

Thanks in advance!


Are you saying that the CNC machine responds correctly to the command when you send it in MAX but not in your code?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 7
(3,210 Views)

First: You realize that you wired a false to the Stop in the while loop. You have an infinite loop sending the same command over and over again. The CNC probably doesn't know what to do with all that data coming in.


Second: You have no termination character in your command @,Z,0,5,'W',231,0,255,190

Is the CNC looking for one?? Usually it is a \r or a \n. The default for End Mode for Write is NONE. You need to manually add the term character to the command, or change the property of the serial port.

 

my help.png

0 Kudos
Message 3 of 7
(3,191 Views)

No, what I meant was that I my CNC is comunicating correctly to my PC, since MAX is connecting to it and I'm also being able to send it write comands through MAX. The problem is that it doesn't seems to be recieving the message that I'm trying to send through the code.

 

Thanks for your response! 

0 Kudos
Message 4 of 7
(3,162 Views)

Right, I've removed the while loop from the write command so it would write it just once.

About the termination character, the manual for the DNC that I'm using does not say anything about it, so I tryied both ways: changing the proprety of the serial and writing it direct on the string, but neighter worked.

 

Thanks for your response! 

0 Kudos
Message 5 of 7
(3,159 Views)

If you exited LabVIEW completely, then ran your new vi, it would work the first time.  All other times will be a crap shoot and probably will not work at all.  You are initializing the port at the beginning without closing it.  Most ports do not like to be opened a second time while the first is still active.  You need to add a VISA Close to the end of your vi. similar to below.

VISAwrc.png

This way it should be able to work multiple times without having to leave LabVIEW.  NI-MAX treats each entry similar to above. 

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 6 of 7
(3,155 Views)

Old thread, but here is what i have:

If you have a CNC controller that is compatible GRBL 1.1 then I think I have what you need:

https://lavag.org/files/file/303-rgbl-11/

I was able to control a GRBL controller based on a Arduino Mega with firmware GRBL 1.1 that has a CNC shield connected to it.

Benoit

0 Kudos
Message 7 of 7
(2,790 Views)