Hello Guest it is March 28, 2024, 05:22:36 PM

Author Topic: Scripter Compile Error bites again :(  (Read 15377 times)

0 Members and 1 Guest are viewing this topic.

Offline rcaffin

*
  •  1,052 1,052
    • View Profile
Re: Scripter Compile Error bites again :(
« Reply #40 on: March 13, 2018, 07:06:26 PM »
My CS-LABS controller has a custom code M84 instead of G84 - pretty certain the rigid tapping is done directly in the controller not Mach.
Problematic, but ...

You see, when Mach3 tries to interpret the G84 instruction, it has to do something. It was not written (afaik) to be able to hand off an entire g-code instruction to an external controller. In fact, I don't believe such external controllers even existed when Art started writing Mach1 and then Mach2.

So what Mach3 is doing internally - dunno, but I am sure it is trying to sync the spindle index pulse to the Z axis movement - in exactly the same way that Mach3Turn does threading.  It is EXACTLY the same same thing.

Now, if CS-Labs is using a macro M84 instead - it would be extremely interesting to know what the macro contains! What is it telling the controller? How is it handled? Enquiring minds want to know!

Greg and Andy at Warp9 are trying to get the ESS to handle a full encoder rather than rely on the Index pulses. This is tricky for two reasons: Mach3 does not rely on the external engine for the sync process (as above), plus there is limited room in the FPGA in the ESS for a PID control loop. But the demand is there in the customer base. That means we keep hassling Andy about the delivery date for this.

What we really need is for Mach5 (5, not 4) to be able to negotiate with an external pulse engine over how to handle the more complex commands. That is, Mach5 needs to be able to send the whole command to the external engine and to be told when the instruction has completed. That also means we will need a whole new generation of external controllers. That is going to take some time to happen. Yeah, dreaming ...

Cheers
Roger

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Scripter Compile Error bites again :(
« Reply #41 on: March 14, 2018, 03:22:28 AM »
Here is the M84 code.....

Code: [Select]
'V2
Parg = Param1()
Qarg = Param2()
Rarg = Param3()
Speed = GetRPM()
Zpos = GetOEMDro(180)

If Parg = 0 Then
Message"M84 ERROR  P = 0"
DoOEMButton(1003)
Sleep(50)
DoOEMButton(1002)
End
End If

If Rarg = 0 Then
Message"M84 ERROR  R = 0"
DoOEMButton(1003)
Sleep(50)
DoOEMButton(1002)
End
End If

If Speed = 0 Then
Message"M84 ERROR  S = 0"
DoOEMButton(1003)
Sleep(50)
DoOEMButton(1002)
End
End If


If Zpos < Qarg Then
Message"M84 ERROR  Zstart < Q !!!"
DoOEMButton(1003)
Sleep(50)
DoOEMButton(1002)
End
End If


If Zpos = Qarg Then
Message"M84 ERROR  Zstart = Q !!!"
DoOEMButton(1003)
Sleep(50)
DoOEMButton(1002)
End
End If

Qarg = Qarg - Zpos

Qarg = Abs(Qarg)

If Qarg < 0.001 Then
Message"M84 Canceled"
End
End If

Message"M84  START"
' set parameters in user dro
SetUserDRO(1511, Qarg) ' depth
SetUserDRO(1512, Parg) ' pitch
SetUserDRO(1513, Speed) ' rpm ffd
SetUserDRO(1514, Rarg) ' rpm rev

' start rigid tapping cycle
NotifyPlugins(10101)

' wait for csmio-ip end of rigid tapping cycle
SetUserDRO(1510, 0)
While(GetUserDRO(1510) = 0)
Sleep(50)
NotifyPlugins(10102)
Wend
Message"M84 DONE"                         
   

And here is what the input code looks like...

Code: [Select]
(M5 TAP)
N3036 M5
N3038 M9
N3040 M1
N3042 T6 M6
N3044 G54
N3046 M7
N3050 G0 X-9.5 Y-7.9
N3052 G43 Z34.612 H0
N3056 Z24.612
N3058 Z23.612
N3060 M84 Q11.262 P0.8 S350 R350
N3062 Z23.612
N3066 Z34.612

Would there ever be a Mach5?

While converting macros to .mcc versions, I did find one bug - the macro Feedrate.m1s would not compile, syntax error, it contained this line of code....

Feed = commanded feed()  Setfeedrate ( feed )

I split it onto two lines and it saved ok, no idea what it does or even if it ever gets used but would not compile in its original form.

Offline rcaffin

*
  •  1,052 1,052
    • View Profile
Re: Scripter Compile Error bites again :(
« Reply #42 on: March 14, 2018, 04:37:54 AM »
Art's inventive genius never ceases to amaze me.

OK, the magic sauce is that line NotifyPlugins towards the end, which triggers the MyNotify function in any loaded plugin. A parameter (10101) is passed which the CS-Labs Plugin recognises as being for M84. The plugin reads data from the DROs which were just set up and sends that info to the CS-Labs external engine. The limitations of the 'standard' comms (basically G1 and G0) are bypassed that way.

The difference here is that the CS-Labs hardware relies on the SW plugin running under Mach3 for the extra info. As I said, Art was a bit of a genius.

The FeedRate macro had been corrupted somehow by Mach3. There should have been a Linux-style LineFeed between the two instructions, but Windows is not real good with that Linux feature: it prefers <CR><LF>. Trying to edit a macro using NotePad can be tricky: you need to use the embedded VB Script Editor to get the right line format.

Cheers
Roger

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Scripter Compile Error bites again :(
« Reply #43 on: March 14, 2018, 04:56:29 AM »

The FeedRate macro had been corrupted somehow by Mach3. There should have been a Linux-style LineFeed between the two instructions, but Windows is not real good with that Linux feature: it prefers <CR><LF>. Trying to edit a macro using NotePad can be tricky: you need to use the embedded VB Script Editor to get the right line format.

Cheers
Roger



Yes, always use the editor, Notepad does make a mess of it, as does TextEdit on a Mac (worse in fact)

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: Scripter Compile Error bites again :(
« Reply #44 on: March 14, 2018, 06:49:29 AM »
Notepad works perfectly fine. I've used it for all of the macros I've written, and never had a problem.
The Mach3 editor doesn't use carriage returns, and saves macros as one long line of code.

Quote
Would there ever be a Mach5?

Since most Mach3 users don't appear to want to move to Mach4, it's highly unlikely.
By the time Mach4 is 100% complete, it will probably have taken 7+ years of development. As a ground up new program, this was their chance to make the best Mach that they could.
Maybe that's what they did, but it's not the Mach4 that many wanted.
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html

Offline rcaffin

*
  •  1,052 1,052
    • View Profile
Re: Scripter Compile Error bites again :(
« Reply #45 on: March 14, 2018, 07:22:48 AM »
Quote
The Mach3 editor doesn't use carriage returns, and saves macros as one long line of code.
Not quite. Open a macro up with Notepad and indeed that's what it looks like.
Now open it up with the VB Script Editor and you will find it nicely laid out.
Different NewLine characters is the reason. <NL> as opposed to <CR><LF>

Ah well, there is always UCCNC and so on.

Cheers

Offline Tweakie.CNC

*
  • *
  •  9,196 9,196
  • Super Kitty
    • View Profile
Re: Scripter Compile Error bites again :(
« Reply #46 on: March 14, 2018, 07:37:13 AM »
Quote
Since most Mach3 users don't appear to want to move to Mach4, it's highly unlikely.
By the time Mach4 is 100% complete, it will probably have taken 7+ years of development. As a ground up new program, this was their chance to make the best Mach that they could.
Maybe that's what they did, but it's not the Mach4 that many wanted.

I should not be crytical because I could certainly not do anything better myself but  +1 to Gerry for summing up the situation regarding the original, long-term, Mach3 users.

Quote
Ah well, there is always UCCNC and so on.

Ohh Roger, what are you thinking ;D

Tweakie.
PEACE

Offline rcaffin

*
  •  1,052 1,052
    • View Profile
Re: Scripter Compile Error bites again :(
« Reply #47 on: March 14, 2018, 07:39:42 AM »
:)

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Scripter Compile Error bites again :(
« Reply #48 on: March 14, 2018, 07:57:13 AM »

Ah well, there is always UCCNC and so on.


Not if you invested in a CS-LABS controller ;)

Offline Davek0974

*
  •  2,606 2,606
    • View Profile
Re: Scripter Compile Error bites again :(
« Reply #49 on: March 14, 2018, 07:59:04 AM »
Notepad works perfectly fine. I've used it for all of the macros I've written, and never had a problem.
The Mach3 editor doesn't use carriage returns, and saves macros as one long line of code.

Quote
Would there ever be a Mach5?

Since most Mach3 users don't appear to want to move to Mach4, it's highly unlikely.
By the time Mach4 is 100% complete, it will probably have taken 7+ years of development. As a ground up new program, this was their chance to make the best Mach that they could.
Maybe that's what they did, but it's not the Mach4 that many wanted.

That explains why i blamed Notepad - on opening in NP the files are indeed one line, open in editor and they are ok - my presumption was that Notepad did not open it correctly and was therefor Fubar :)

I stand corrected, thanks