LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data acquisition triggered by CNC code

Goodmorning everyone, 

 

i'm working with a lathe and i'm trying to acquire some sensor data from a turning process. Since it's very difficoult to manually start the data acquisition i wuold like to automatize that process, in particoular i would like to start the acquisition when a determined line is read by the machine.

I'm quite desperate bacuse I really don't know where to begin.

 

I read something on the internet about a command DPRNT that send a value from the machine to the PC but what i can I use this value to trigger the data acquisition?

 

Thank you for your help!

 

Regards,

Lorenzo

0 Kudos
Message 1 of 8
(4,748 Views)

Hi Lorenzo,

Could you provide a little more information regarding your setup? How are you sending the command from the machine to the PC (serial cable, RS232)? And what hardware are you using to acquire data? 

Thanks!

Rick C.
0 Kudos
Message 2 of 8
(4,709 Views)

Here is a straightforward way to accomplish what you are trying to do, assuming you don't need a hard real-time trigger (G-code would not be real-time).

 

If your lathe's CNC controller supports general purpose digital outputs, you can command those to assert using the appropriate G-code command.  These general purpose digita outputs (and analog too) are intended for things like turining on vacuum, cooling liquid pumps, light towers, and other periferals, but they can easily be adapted to almost any other purpose.  Again, this advice will only apply if your CNC caontroller supports these additional controls.  They are typically 24VDC, 12VDC, or 5VDC.

 

On the PC end, you will need a data acquisition device, to capture the trigger, and begin acquiring whatever it is you need to capture at that moment (temperature, RPM, voltage, amps, etc.)

 

The codes you need will vary from controller to controller.  You will need to enter them in by hand where you need the triggers.

M62, M63, M64, and M65 are commonly used for this on some controllers.

 

M62 ( M62:(EMC2) turn on digital output synched with motion )
M63 ( M63:(EMC2) Turn off digital output synched with motion )
M64 ( M64:(EMC2) Turn on digital output immediately )
M65 ( M65:(EMC2) Turn off digital output immediately )
Machine Vision, Robotics, Embedded Systems, Surveillance

www.movimed.com - Custom Imaging Solutions
Message 3 of 8
(4,701 Views)

First of all thank you everybody for your answers!

 

The lathe i'm using is a Nakamura-Tome SC450, FANUC version 21-TB, withthe port RS-232 (port 0). The RS 232 is adaptated in order to end with a usb connection.

 

I'm using 3 different DAQ devices: NI 9215 A for voltage, NI 9243 for the accelerometer and NI 9219 for the termocouple.

All equipped with NI 9162 USB adapter.

So in total I have 4 usb: 3 sensors and the RS 232 port.

 

 

Thanks MoviJHON, I will try your solution!

 

The method i was thinking to adopt is this:

...

T1212(MULTI TOOL)                      
G0Z100.X14.
M8
G96M3S100
Z5.

POPEN

DPRNT[STARTDATA1]

PCLOSE
G1Z-8.F.05      

POPEN

DPRNT[ENDDATA1]

PCLOSE                               
G0Z2.                                     
#1=#501-1.
#2=15.

...

 The fact is that i absolutely don't now how aquire these string in labview and how to use them to trigger the acuisition of the data!

 

Regards, 

Lorenzo

 

 

 

MoviJOHN

0 Kudos
Message 4 of 8
(4,691 Views)
It would be a simple serial read. Look at the examples that come with LabVIEW. It would be looking for a particular string and starting your acquisition but there would be some lag and your lathe could very well be running the g code before the LabVIEW program could respond.
0 Kudos
Message 5 of 8
(4,681 Views)

I've looked into the serial read and it is just was I was looking for, thanks for the advice!

 

Just a couple of doubts:

-Since the RS-232 is adaptated to plug into the PC through a USB, while setting up the serial read, in the "Instrument property node" block I should consider it USB or Serial?

-Once that I read the string coming from the machine, I should use a "software" trigger, correct?

 

Thank you again.

 

Regards

0 Kudos
Message 6 of 8
(4,649 Views)
The connection is a virtual serial port. You probably don't need a separate property node at all, just the VISA Configure Serial Port which has the necessary properties on the block diagram.

Yes, this would be a software trigger, which as I noted, might not be fast enough.
0 Kudos
Message 7 of 8
(4,643 Views)

Are there any chances that this programm will work? 

In the G-code there are 4 commands to send a string, 2 to monitor the time and 2 to start the acquisition.

My main doubt is: if I set the data acquisition for 2 sec, since it is in the case structure, when the condition of true is met the data acquisition should start but it will last 2 sec or just until the condition of true is no more met?

 

I'm sorry if the question may appear silly to many of you, but before assigning me this task I had never used labview!

 

Thank for the patience

 

Regards, 

Lorenzo

0 Kudos
Message 8 of 8
(4,608 Views)