What's new
What's new

Fanuc 21-T M-Code Sensor Trigger

bradyc

Plastic
Joined
Jun 23, 2022
Hi,

I have a mill being controlled with a Fanuc 21-T controller. I purchased the equipment for serial communication from my pc (RS 232 to usb) but it seems this is only for transfering files to/from the pc/machine.

Is there a way to monitor the g-code execution in live time to detect when a custom m-code is called, and use this call to trigger the PC to activate my sensor recording? If the serial port method won't work during operation is there another way to achieve this? (Such as wiring a relay to the machine where an electrical circuit in the machine is triggered via the M-code?) Thanks for any help/ ideas :)
 

GENERALDISARRAY

Hot Rolled
Joined
Jan 3, 2019
You can write out of the program through the RS232 port with Dprint. Search the forum for that.

you already have the relay triggered by m-code. M08 is one you can piggyback onto.
 

dandrummerman21

Stainless
Joined
Feb 5, 2008
Location
MI, USA
There are most likely spare m-codes that you can wire up to. You'd have to consult your electrical manual for the machine.

You can also use the DPRNT command to send out data thru rs232, and have a program monitor for sent data on the pc to trigger your pc to do whatever you're doing.

POPEN
DPRNT[HELLO WORLD]
PCLOS

I think that requires macro B. You likely have macro B
 

bradyc

Plastic
Joined
Jun 23, 2022
There are most likely spare m-codes that you can wire up to. You'd have to consult your electrical manual for the machine.

You can also use the DPRNT command to send out data thru rs232, and have a program monitor for sent data on the pc to trigger your pc to do whatever you're doing.

POPEN
DPRNT[HELLO WORLD]
PCLOS

I think that requires macro B. You likely have macro B
This is perfect thank you, I was so set on using an M-code I never even thought of this workaround. Thanks!
 








 
Top