Activate Laser M76func issue

All things related to the Centroid Acorn CNC Controller

Moderator: cnckeith

cryptonym
Posts: 25
Joined: Sun Feb 20, 2022 2:22 am
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Activate Laser M76func issue

Post by cryptonym »

Using 4.82.

Really odd problem with the laser align macro. It is leaving the laser on after completion. The manual laser toggle button works. The one in the laser check function works.

If I go to single block mode and step through the macro, the laser turns off after the m94 /29. Run full speed and it stays on. I tried adding G04 dwells and no change. But if I uncomment the line below m94 with the on screen message, it turns off.

Seems like some real strange dependency or timing issue?
Attachments
report_30E283D7B993-0126225583_2023-01-24_16-04-44.zip
(1.05 MiB) Downloaded 3 times
cnckeith
Posts: 7164
Joined: Wed Mar 03, 2010 4:23 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: Yes
CNC Control System Serial Number: none
DC3IOB: Yes
CNC11: Yes
CPU10 or CPU7: Yes
Contact:

Re: Activate Laser M76func issue

Post by cnckeith »

use the alt i plc diagnostic menu to observe the laser on/off output during the M76 macro execution.
Need support? READ THIS POST first. http://centroidcncforum.com/viewtopic.php?f=60&t=1043
All Acorn Documentation is located here: viewtopic.php?f=60&t=3397
Answers to common questions: viewforum.php?f=63
and here viewforum.php?f=61
Gear we use but don't sell. https://www.centroidcnc.com/centroid_di ... _gear.html
cnckeith
Posts: 7164
Joined: Wed Mar 03, 2010 4:23 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: Yes
CNC Control System Serial Number: none
DC3IOB: Yes
CNC11: Yes
CPU10 or CPU7: Yes
Contact:

Re: Activate Laser M76func issue

Post by cnckeith »

cryptonym wrote: Wed Jan 25, 2023 6:41 pm Using 4.82.

Really odd problem with the laser align macro. It is leaving the laser on after completion. The manual laser toggle button works. The one in the laser check function works.

If I go to single block mode and step through the macro, the laser turns off after the m94 /29. Run full speed and it stays on. I tried adding G04 dwells and no change. But if I uncomment the line below m94 with the on screen message, it turns off.

Seems like some real strange dependency or timing issue?
I just tested it on v4.82 router and it works just as it is suppose to.

have you edited the PLC program? i see evidence of hand edits?

use the Wizard generated PLC program to get things working before going off and hand editing the VCP or PLC etc.. otherwise you just dug yourself a hole. :D


i see you have LaserAlignActivate on the Ether1616, while that should work just fine, as an experiment move it to an output on the Acorn and report back.
Need support? READ THIS POST first. http://centroidcncforum.com/viewtopic.php?f=60&t=1043
All Acorn Documentation is located here: viewtopic.php?f=60&t=3397
Answers to common questions: viewforum.php?f=63
and here viewforum.php?f=61
Gear we use but don't sell. https://www.centroidcnc.com/centroid_di ... _gear.html
cryptonym
Posts: 25
Joined: Sun Feb 20, 2022 2:22 am
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: Activate Laser M76func issue

Post by cryptonym »

I moved the output to acorn board off of 1616, no change.

I saved my current setup folder and did a fresh install of 4.82. Setup motors, limits, etc only in wizard. Set the laseralign output too in output section.

Tested, and same issue. Problem moves regardless of what out I use. As soon as I uncomment the M225 linein mfunc76, it works.

broken [as installed]:

Code: Select all

M95 /29				;turn off LaserAlignActivate
;M225 #104 "#)**XY LOCATION SET**\nPRESS CYCLE START/ESC TO EXIT"
works:

Code: Select all

M95 /29				;turn off LaserAlignActivate
M225 #104 "#)**XY LOCATION SET**\nPRESS CYCLE START/ESC TO EXIT"
That was as stock as I could make it. Attaching new reports file.

I ran the laser check xy, and it works properly?!?!?! Laser turns off after m95/29, no need for a message.

I am using the Intel NUC recommended: NUC10i3FNB, 16GB RAM, 500GB disk.
Attachments
report_30E283D7B993-0126225583_2023-01-26_16-51-50.zip
(752.68 KiB) Downloaded 7 times
cncsnw
Posts: 3763
Joined: Wed Mar 24, 2010 5:48 pm

Re: Activate Laser M76func issue

Post by cncsnw »

The problem is the code on lines 4889-4890 of the PLC program:

Code: Select all

IF (LaserAlignPD && LaserAlignActivate && !LaserAlignActivate_SV) ||
	(!LaserAlignActivate_SV && SV_PROGRAM_RUNNING && !LaserAlignVCP_M) || SV_STOP THEN RST LaserAlignActivate
This will use absence of the M function request (SV_M94_M95_29, "LaserAlignActivate_SV") to turn off the laser, but only if a program cycle is running. The supplied macro (without M225) ends immediately after M95/29, so by the time the PLC program sees that the M function request has been turned off, the program cycle is no longer running, and the turn-off logic above does not apply.

A simple workaround would be to replace the M225 with "G4 P0.1", which would keep the program cycle running long enough for the PLC to see that the M function request was turned off.

In the long run, it would be better for Centroid to modify the standard PLC program: perhaps to use a PD on !LaserAlignActivate_SV to detect when the laser is being turned off by the M function; or perhaps by simplifying the logic so that the VCP key turns LaserAlignActivate_SV on and off, instead of having its own independent status bit to maintain.
cryptonym
Posts: 25
Joined: Sun Feb 20, 2022 2:22 am
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: Activate Laser M76func issue

Post by cryptonym »

I will try the dwell again, but I had tried a G4 P0.5 and was still failing. It does behave as a race condition, I agree.
Allin1Chris
Posts: 132
Joined: Wed Jul 31, 2019 12:53 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: Yes
CNC Control System Serial Number: none
DC3IOB: Yes
CNC12: Yes
CNC11: Yes
CPU10 or CPU7: Yes

Re: Activate Laser M76func issue

Post by Allin1Chris »

cncsnw wrote: Thu Jan 26, 2023 6:49 pm or perhaps by simplifying the logic so that the VCP key turns LaserAlignActivate_SV on and off, instead of having its own independent status bit to maintain.
This logic is changed to something similar i think you are suggesting in the upcoming V4.99 rev 4 beta (V5.00 release). Will likely correct for this issue as well. Here is the logic in PLC,

Code: Select all

;LaserAlignActivate
IF SkinLaserAlign_M THEN (LaserAlignPD)
IF LaserAlignPD && !LaserAlignActivate THEN SET LaserAlignActivate_SV
IF LaserAlignPD && LaserAlignActivate THEN RST LaserAlignActivate_SV

IF LaserAlignActivate_SV THEN (LaserAlignActivate)

IF LaserAlignActivate THEN (LaserAlignLED)
When requesting support READ THIS POST first. http://centroidcncforum.com/viewtopic.php?f=60&t=1043

Please ALWAYS post a FRESH report. To make a report: https://www.youtube.com/watch?v=Ecvg0VJp1oQ.

(We pride ourselves on providing timely solid technical support but, without good information we may not be able to help and/or reply until such information is posted.)

Centroid PLC Tutorial Videos
cncsnw
Posts: 3763
Joined: Wed Mar 24, 2010 5:48 pm

Re: Activate Laser M76func issue

Post by cncsnw »

Yes, that should work. You could get the same result with less code by using XOR for the toggle operation:

Code: Select all

;LaserAlignActivate
IF SkinLaserAlign_M THEN (LaserAlignPD)
IF LaserAlignPD ^ LaserAlignActivate_SV THEN (LaserAlignActivate_SV)

IF LaserAlignActivate_SV THEN (LaserAlignActivate),
                              (LaserAlignLED)
cncsnw
Posts: 3763
Joined: Wed Mar 24, 2010 5:48 pm

Re: Activate Laser M76func issue

Post by cncsnw »

... and, if it is still desired to turn off the laser in case of Fault or Emergency Stop:

Code: Select all

;LaserAlignActivate
IF SkinLaserAlign_M THEN (LaserAlignPD)
IF (LaserAlignPD ^ LaserAlignActivate_SV) && !SV_STOP THEN (LaserAlignActivate_SV)

IF LaserAlignActivate_SV THEN (LaserAlignActivate),
                              (LaserAlignLED)
ShawnM
Posts: 2190
Joined: Fri May 24, 2019 8:34 am
Acorn CNC Controller: Yes
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 7804734C6498-0401191832
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Location: Clearwater, FL

Re: Activate Laser M76func issue

Post by ShawnM »

Try my macro and see if it works for you. Just rename the file after you download it and remove the .txt at the end of the file name. If your crosshair laser is mounted to the Z axis and you need to lower if for focus you can edit the value in the script. By default it does not move the Z axis for focusing as my crosshair laser is mounted to a fixed location. This macro works with 4.82 as it pulls the offset values from the wizard stored parameters. Read the file and make any changes you'd like. Let me know if it works for you and turns off after the move to X0, Y0.
mfunc76.mac.txt
(2.11 KiB) Downloaded 10 times
Post Reply