LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Connecting to GRBL

Hello everybody,

 

I'm a real beginner of LabVIEW and trying to control the xy plotter with GBRL 1,1f using gcode. Now I'm starting from simple code, but it seems the machine doesn't receive the code properly. There is no error message in LabVIEW but machine doesn't work. In addition, when I read the buffer, there is only the message of "Grbl 1.1f ['$' for help]". I think connection is well but there are some problems in sending code. Does anyone have idea of what happened here?

Please help me and thank you in advance!

0 Kudos
Message 1 of 3
(1,183 Views)

Try add a sequence with the wait inside between writing and reading. this way you ensure that the program waits AFTER writing. 

 

ROtake_0-1685827080367.png

Also try using NI-VISA Interactive control just to send commands and write without coding for sanity check and test the commands. Ensure that the serial setup is correct. 

 

 

RKO
0 Kudos
Message 2 of 3
(1,122 Views)

A couple of comments:

  • This is a LabVIEW Forum.  For LabVIEW users, "G code" means "the graphic embodiment of LabVIEW code", such as a rectangle with rounded corners and an arrow built into the lower right corner going counter-clockwise meaning a "While" statement.  It turns out that GBRL is another "language" for CNC control that also calls itself "g code".
  • You almost never need (nor should you use) a "Frame Sequence" (the rectangular piece of G Code that looks like it has movie sprocket holes along the top and bottom boundaries), especially if you explicitly enforce the rules of Data Flow by wiring your VIs serially using the Error Line (which you do!).
  • There have been numerous discussions of the "right way to do VISA" (@crossrulz, an active Forum member, has a number of Posts on the Forum on this.  Take a look at this video which explains "how" and "why" to communicate with most devices using VISA.
  • In particular, when setting up VISA, leave the "Enable Termination character" set to its default value of "True", particularly if your VISA device uses a "Command and Response" model where you write "Do Something", and the Instrument responds (or not).  The idea is that you don't know when VISA has the entire response.  If you gave a command that doesn't produce a response, fine, you just "do what comes next".  But if the device is going to response, you follow the Write with a Read, and specify 1000 (or, if you like powers-of-2, 1024) for the number of characters (it doesn't matter, as long as it is bigger than any response you can receive).  Because you specified the use of a Termination character, the Read will wait until that character is received, and now you have a string to parse.  You can use the "String Length" function to get the String size, but you can also simply parse the String (since you'll know the format of the Response, and can use "Scan from String" to turn the String into "parameters" for you).

Bob Schor

0 Kudos
Message 3 of 3
(1,099 Views)