Hello Guest it is April 18, 2024, 10:10:11 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - rotahed

Pages: 1
1
VB and the development of wizards / Re: THC AND MACH3
« on: February 15, 2010, 04:14:45 AM »
Hi All

Just thought I would post to close this topics as all issues have been resolved.
With some help from DaveCVI and Zealous Thanks guys.

Christian'

2
Hi Dave , Zealous

Thanks for the advice. I tried the loop but the program just got stuck in the loop and didn't end. However I have achieved the same result with a somewhat less elegant system of If statements and the incrementation of the Var.

Also I removed the Underscore from the message box code and it fixed it SWEET!  Just A side note I had copied and pasted the code from the Mach3 V3.x Programmer Reference Draft v0.11a.pdf
And it had the underscore it the example so maybe it needs an update Just A thought.


Anyway Thanks very much for the help.

Cheers

Christian

P.S. Dave what did you mean by
Quote
( you will have to take out the extra CRLFs inserted by the board width limitation when this was pasted)
Also the option explicit you added at the top of the code caused the same syntax error I removed and it was fine.


3
Hi Dave

Thanks for the response. I will test it out a little later this evening. I have no prior VB knowledge so in the last few days I have learned a lot. When I wrote the above piece I was cross referencing between a VB.net book we had lying around the office and the other cypress doc and when it appeared right and then didn't function it nearly drove me bonkas!  ;D

Thanks again

Christian


4
Can Someone tell me what is wrong with this piece of VB code It seems right but throws up Compile Error syntax error!

Code: [Select]
If IsOutputActive(OUTPUT1) And GetVar(1) = 300 And Not IsActive(OEMTRIG1) Then
For counter = 1 To 3
DeActivateSignal(OUTPUT1) 'turn off output1
Message ("Waiting For THC To Establish An Arc") 'display message
Sleep (3000)
ActivateSignal(OUTPUT1)
Sleep (3000) 'sleep time in milliseconds
Message ("")
If IsOutputActive(OUTPUT1) And IsActive(OEMTRIG1) Then
DoOEMButton(1000)
Message ("ARC ESTABLISHED")
Sleep (2000)
Message ("")
Exit For
If counter = 3 Then
MachMsgTypeOK = 0 'Define some constants for MachMsg dialog types
MachMsgReturnOK = 1 'Define some constants for MachMsg return codes 'Display an Abort/Retry/Ignore dialog
Ret = MachMsg("Plasma Failed to Start three times. Press OK to Abort program", _"FLAME OUT WARNING", MachMsgTypeOK)

If Ret = MachMsgReturnOK Then
DoOEMButton(1003)
End If
End If



End If
Next
End If

Thanks In Advance
Christian

5
VB and the development of wizards / Re: THC AND MACH3
« on: February 12, 2010, 07:54:55 PM »
Hi All

Let me first say to all beginners MAKE SURE YOU READ THE CYPRESS ENABLE AND MACH3 PROGRAMMERS REFERENCE PDF'S CAREFULLY!!!!!!

After going back and reading these for the millionth time I found I had made a few mistakes mainly "IsActive(OUTPUT1)" instead of "IsOutputActive(OUTPUT1)"
and "IsActive(OEMTrigger1)" instead of "IsActive(OEMTrig1)" Silly dumb monkey  :-[

Anyway here is the code that actually works

Code: [Select]
Sub main()
'i=i+1
'message "Macro Running #"&i


If GetOEMLED(851) And GetVar(1) = 0 Then 'check enable6 is active and variable UserDRO(1000) is not active
DoOEMButton(1001)
ActivateSignal(OUTPUT1)
'Sleep (6000) 'Do button Feed Hold  (pause motion on machine)
End If



If IsOutputActive(OUTPUT1) And IsActive(OEMTRIG1) Then         'check output1 and oemtrigger1 (RTG) are active

DoOEMButton(1000)
SetVar(1,200) 'Set cycle start when they are active
'Set variable UserDRO(1000) to 1 or high
End If

If IsOutputActive(OUTPUT1) And Not IsActive(OEMTRIG1) And GetVar(1) = 200  Then

DoOEMButton(1001)
End If

If Not GetOEMLED(851) Then
DeActivateSignal(OUTPUT1)
End If



'If IsActive(OUTPUT1) And (GetUserDRO(1000) = 1) And Not IsActive(OEMTRIG1) Then      'check output1 is true and variable userdro(1000) is 1 and OEMTrigger1 is False
'DoOEMButton(1001) 'press feed hold button if RTG Drops away
'GoTo flameout 'proceed to flameout routine
'End If

End Sub


It doesn't do exactly what I want but it is a start so will keep you all posted!


6
VB and the development of wizards / Re: THC AND MACH3
« on: February 12, 2010, 12:49:02 AM »
HI all

OK after trawling the forum for various bit and pieces I decided to have a go at writing some vb for my macro pump but when I try to step through I get errors and I'm not sure what I have done wrong errors are as follows.

Error on line 24- label not defined. (also if I remove the end sub after the goto statement and place it at the very end of the code the error disappears and I get the following error "Compile error syntax error" and it highlights the SU in the End Sub line.)

Its driving me nuts! please help

Thanks in advance
christian


Code: [Select]
Sub main()




If IsActive(ENABLE6) And (GetUserDRO(1000) = 0)Then 'check enable6 is active and variable UserDRO(1000) is not active
DoOEMButton(1001) 'Do button Feed Hold  (pause motion on machine)
End If

If IsActive(ENABLE6) And (GetOEMLed(111) = True) Then    'check that Enable6 and Feed Hold(OEMLed) are true
ActivateSignal(OUTPUT1) 'Activate Output1 or Fire torch.
End If

Sleep (100)

If IsActive(OUTPUT1) And IsActive(OEMTrigger1) Then         'Loop until output1 and oemtrigger1 (RTG) are active
DoOEMButton(1000) 'Set cycle start when they are active
SetUserDRO(1000,1) 'Set variable UserDRO(1000) to 1 or high
End If

If IsActive(OUTPUT1) And (GetUserDRO(1000) = 1) And Not IsActive(OEMTrigger1) Then      'check output1 is true and variable userdro(1000) is 1 and OEMTrigger1 is False
DoOEMButton(1001) 'press feed hold button if RTG Drops away
GoTo flameout 'proceed to flameout routine
End If






flameout:
For counter = 1 To 3   'loop 3 times
DeActivateSignal(OUTPUT1) 'turn off output1
Message ("Waiting For THC To Establish An Arc") 'display message
Sleep (3000) 'sleep time in milliseconds
ActivateSignal(OUTPUT1) 'turn on output1
Sleep (3000) 'sleep time in milliseconds
Message ("")
If IsActive(OUTPUT1) And IsActive(OEMTrigger1) Then 'check output1 and oemtrigger1 if true press cylestart
DoOEMButton(1000) 
End If
IF counter = 3 Then


'Define some constants for MachMsg dialog types
MachMsgTypeOK = 0
'Define some constants for MachMsg return codes
MachMsgReturnOK = 1
'Display an Abort/Retry/Ignore dialog
Ret = MachMsg("Plasma Failed to Start three times. Press OK to Abort program", _"FLAME OUT WARNING", MachMsgTypeOK)

If Ret = MachMsgReturnOK Then
DoOEMButton(1003)
End If
 End If
Next

End Sub



7
VB and the development of wizards / THC AND MACH3
« on: February 09, 2010, 11:07:00 PM »
Hi

My farther and I developed a THC device (independently controls the Z motor) to upgrade a customers old CNC plasma (using a hypertherm 1100). Since this has been functioning perfectly for the last couple of months the customer wants to get some extra functionality that their software will not allow.

This is where Mach3 comes in I believe.

I have been playing with the trial program and have successfully got inputs and outputs to trigger relays and what not. I have also modified macros to do specific tasks push buttons and. We also wrote some brains and they worked to a point and then it broke my brain. As a result I think maybe I need to write a macropump. Correct me If I'm Wrong
But I have virtually no experience with VB and have no idea whether what I want to do is possible.

If anyone could have a look at my scenario and maybe help me out and point me in the right direction it would be great. Ie do I use a brain and then call a macro from the brain or just use the macropump.



Control Process

macro And Functions

M3 - set Enable6, unset (Retry ) Variable

M5 - unset Enable6, unset (Machine is cutting) Variable



Main Program Routine
Run Gcode, M3 send torch fire signal-feedhold-wait for RTG signal from plasma unit-when RTG active-cycle start



check if Enable6 is active (Enable6 is set by m3 macro and unset by the M5 macro)
if Enable6 is and (Machine is cutting) Variable DeActive then DoOEMButton(1001) 'feed hold' (press once)
if Enable6 is active and FeedHold active, activate Output1

if Output1 is active and OEMTrigger1 not active wait (some amount of time not specified yet) then repeat this step
check Output1 and check OEMTrigger1 if both active DoOEMButton(1000) 'cycle start'
when Enable6 and Output1 and OEMTrigger1 Active Set a (Machine is cutting) Variable



Sub Routine
Flame out occurs while machine is in the middle of a part This procedure is to reestablish torch cutting.
Try 3 times or until successfull and continue as normal. If it fails 3 times Display warning for the operator and END Program
(In this instance OEMTrigger1 would drop out)

check OEMTrigger1 check (Machine is cutting) Variable True
if OEMTrigger1 is DeActive and (Machine is cutting) Variable True  DoOEMButton(1001) 'feed hold' (press once) and DeActivate Output1
wait (some amount of time not specified yet) and check OEMTrigger1 is DeActive and (Machine is cutting) Variable True and Output1 DeActive then
Activate Output1
wait (some amount of time not specified yet)
Check if Output1 is active and OEMTrigger1 DeActive DeActivate Output1 and increment (Retry) Variable return to sub-routine start
Check (Retry) Variable if <3 return to sub-routine start If = to 3 then Display Warning on screen and hit stop button.

if Output1 and check OEMTrigger1 if both active DoOEMButton(1000) 'cycle start'
Return To main

 



Thanks in Advance

Christian



Pages: 1