07-26-2017 01:33 PM
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!
07-26-2017 04:58 PM
@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?
07-26-2017 06:49 PM
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.
07-27-2017 09:45 AM
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!
07-27-2017 09:53 AM
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!
07-27-2017 10:06 AM
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.
This way it should be able to work multiple times without having to leave LabVIEW. NI-MAX treats each entry similar to above.
07-26-2018 02:20 AM
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