Home
Downloads
Mach3
Plugins
CAM Post Processors
Screensets
Purchase
Support
Forum
Tutorial Videos
Documentation
Yahoo Group
Mach Wiki
Resources
Contact Us
Links
CNCZone
German Forum
Italian Forum
Korean Forum
Portugese (Brazil) Forum
Russian Forum (RSK CNCROUTER)
Thai Forum
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
May 28, 2012, 01:22:29 PM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
Select from and to languages
Chinese-simp to English
Chinese-trad to English
English to Chinese-simp
English to Chinese-trad
English to Dutch
English to French
English to German
English to Greek
English to Italian
English to Japanese
English to Korean
English to Portuguese
English to Russian
English to Spanish
Dutch to English
Dutch to French
French to English
French to German
French to Greek
French to Italian
French to Portuguese
French to Dutch
French to Spanish
German to English
German to French
Greek to English
Greek to French
Italian to English
Italian to French
Japanese to English
Korean to English
Portuguese to English
Portuguese to French
Russian to English
Spanish to English
Spanish to French
Machsupport Forum
Mach Discussion
VB and the development of wizards
code "G04 P2.0" problem
Pages:
1
2
»
Go Down
« previous
next »
Author
Topic: code "G04 P2.0" problem (Read 2544 times)
0 Members and 1 Guest are viewing this topic.
tantan
Active Member
Offline
Posts: 68
code "G04 P2.0" problem
«
on:
April 24, 2008, 11:36:25 AM »
hi again,
i have the next macro which runs perfect except for the [ code "G04 P2.0" ] part. i am sure the subroutine is executed but the output is not latched for 2 seconds. i hope someone can help me because it is an essential part of my machine. (i run mach3 2.63 version on windows xp).
'SetUserDRO(1200,GetSelectedTool())
'OldTool = GetOEMDRO (1200)
wantedtool = GetOEMDRO (1200) 'GetSelectedTool()
MaxToolNum = 8 'Max number of tools for the changer
If newtool = wantedtool Then
Message ("Selected Tool already loaded")
Exit Sub
End If
'While wantedtool > MaxToolNum
'Tool = Question ("Enter New Tool Number up to " & MaxToolNum)
'Wend
While wantedtool <> newtool
Call actualtool
Call rotateCW
Wend
Call stop_and_lock_turret
'//// Subroutines /////////
Sub actualtool
If isActive(Input1) And isactive(Input2) And isactive(Input3) And Not isactive(Input4) Then
NewTool = 1
End If
If isActive(Input1) And isactive(Input2) And Not isactive(Input3) And Not isactive(Input4) Then
NewTool = 2
End If
If isActive(Input1) And isactive(Input2) And Not isactive(Input3) And isactive(Input4) Then
NewTool = 3
End If
If isActive(Input1) And Not isactive(Input2) And Not isactive(Input3) And isactive(Input4) Then
NewTool = 4
End If
If isActive(Input1) And Not isactive(Input2) And isactive(Input3) And isactive(Input4) Then
NewTool = 5
End If
If Not isActive(Input1) And Not isactive(Input2) And isactive(Input3) And isactive(Input4) Then
NewTool = 6
End If
If Not isActive(Input1) And isactive(Input2) And isactive(Input3) And isactive(Input4) Then
NewTool = 7
End If
If not isActive(Input1) And isactive(Input2) And isactive(Input3) And not isactive(Input4) Then
NewTool = 8
End If
setcurrenttool(newtool)
End Sub
Sub rotateCW
ActivateSignal(Output6)
While IsMoving()
Wend
End Sub
Sub stop_and_lock_turret
DeActivateSignal(Output6)
While IsMoving()
Wend
ActivateSignal(Output5)
Code "G4 P2" 'Wait for the tool to rotate onto ratchet stop
While IsMoving()
Wend
DeActivateSignal(Output5)
While IsMoving()
Wend
End Sub
thanks
antoine
the netherlands
«
Last Edit: April 24, 2008, 11:38:46 AM by tantan
»
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
Offline
Posts: 1,707
Briceville, TN, USA
Re: code "G04 P2.0" problem
«
Reply #1 on:
April 24, 2008, 12:31:58 PM »
just a note,
remove the "While IsMoving(), Wend" statements from your activate and deactivate signals they are pointless there. The while is moving is for Movement type coded commands, i.e. Code "Gxx ...." it is used when you want to wait for the machine to move, this includes the G4 codes.
scott
Logged
Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
tantan
Active Member
Offline
Posts: 68
Re: code "G04 P2.0" problem
«
Reply #2 on:
April 24, 2008, 01:36:31 PM »
thank you for your reply,
what i want with the "G4 p2.0" is that the output 5 stay high for 2 second and then it has to be deactivated. is that possible with the G4 code the way i used it in mach 3 (lathe)?
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
Offline
Posts: 1,707
Briceville, TN, USA
Re: code "G04 P2.0" problem
«
Reply #3 on:
April 24, 2008, 05:56:10 PM »
yes, the way you have it written will work, just only have the while is moving after the G4 only not the activate and deactivates signals
Logged
Commercial Mach3: Screens (regular and flash), Wizards, Plug-ins, Brains, PLCs, Macros, ATC's, machine build, retrofit and Prototyping
http://sites.google.com/site/volunteerfablab/
tantan
Active Member
Offline
Posts: 68
Re: code "G04 P2.0" problem
«
Reply #4 on:
April 25, 2008, 01:28:10 AM »
i am sorry but i do not understand fully what you mean with your latest reply (probably because i am dutch).
what i understand is that i should delete the While IsMoving() function. but can i use the G4 command to delay the activation or deactivation of outputs or is the G4 function not the right one to use for my case?
if i cannot use the G4 command to delay the activation or deactivation of output what function should i use. or do i have to solve this in by hardware?
thanks
antoine
the netherlands
«
Last Edit: April 25, 2008, 01:29:59 AM by tantan
»
Logged
Ron Ginger
V4 Screen Contributor
Offline
Posts: 568
Re: code "G04 P2.0" problem
«
Reply #5 on:
April 26, 2008, 09:46:39 AM »
G4 is the correct function to use for a delay. G4 can measure time in either seconds or miliseconds, there is a check mark on the config screen to select.
While IsMoving is only needed on commands that cause motion, it is not needed on the activate output or deactivate. I dont think it will hurt, but it is not needed.
The following should work
Sub stop_and_lock_turret
DeActivateSignal(Output6)
ActivateSignal(Output5)
Code "G4 P2" 'Wait for the tool to rotate onto ratchet stop
While IsMoving()
Wend
DeActivateSignal(Output5)
End Sub
Logged
tantan
Active Member
Offline
Posts: 68
Re: code "G04 P2.0" problem
«
Reply #6 on:
April 27, 2008, 11:15:57 AM »
hi,
thank you for your reply. I cannot get the code statement working. i open a vb window, type just the commands:
ActivateSignal(Output5)
Code "G4 P2"
then i compile and run the program. the program ignores the code statement!
another strange thing is that my outputs 1 2 3 and 4 on my first i/o card can be switched on by the statement ActivateSignal(...). the output 5 and 6 just pulse with the same statement. does that has something to do with hardware or has mach trouble with outputs 5 and 6.
thanks
antoine
Logged
Ron Ginger
V4 Screen Contributor
Offline
Posts: 568
Re: code "G04 P2.0" problem
«
Reply #7 on:
April 27, 2008, 01:38:22 PM »
How do you know its ignoring the G4?
try this simple test program:
code "G4 P10"
While Ismoving()
Wend
MsgBox "time done"
when I run it in the script editor there is a 10 second delay before the message box appears.
Are you sure output 5 and 6 are setup correctly? Be sure the port number is 2 if they are on the second parport.
Logged
tantan
Active Member
Offline
Posts: 68
Re: code "G04 P2.0" problem
«
Reply #8 on:
April 28, 2008, 11:26:07 AM »
hi ron,
you are right. your test program works fine. the problem is in my hardware. u use 2 parallelports; one (LPT1)on the motherboard of the computer and one extra PCI port. the outputs connected to the first port (lpt1) work exactly as they should. but if i use the same program to control the outputs on the second port they just pulse. if i write a VBscript with one line: activatesignal(output6), output6 is high for just a 0.1 second or so.
i don't understand the difference between the two ports?
thanks antoine
Logged
tantan
Active Member
Offline
Posts: 68
Re: code "G04 P2.0" problem
«
Reply #9 on:
April 28, 2008, 12:03:03 PM »
hi ron
I AM SORRY, i found the problem. let me explain to you what i did.
i began thinking why the outputs of the second port could be disabled almost immediately after is enabled them. i early day i have been programming PLC's. when that happend in PLC's most of the time i had used the specific register twice. this was exactly what happend i my system. a few months ago a have made some test programs in brains. i used the output 5 and 6 and these programs where still enabled in brains control. i disabled the specific brain and everything works fine now.
i hope it did not keep you awake....
thanks Antoine
Logged
Pages:
1
2
»
Go Up
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Mach Discussion
-----------------------------
=> General Mach Discussion
=> Mach3 under Vista
=> Quantum
=> Mach SDK plugin questions and answers.
===> Finished Plugins for Download
=> VB and the development of wizards
=> Brains Development
=> Video P*r*o*b*i*n*g
=> Mach Screens
===> Screen designer tips and tutorials
===> Works in progress
===> Finished Screens
===> Flash Screens
===> JetCam screen designer
===> Machscreen Screen Designer
===> CVI MachStdMill (MSM)
=> Feature Requests
=> Non English Forums
===> Italian
===> French
===> Spanish
===> Chinese
===> German
===> Russian
===> Romanian
===> Japanese
===> Vietnamese
=> FAQs
-----------------------------
*****VIDEOS*****
-----------------------------
=> *****VIDEOS*****
-----------------------------
General CNC Chat
-----------------------------
=> Share Your GCode
=> Show"N"Tell ( What you have made with your CNC machine.)
=> Building or Buying a Wood routing table.. Beginnners guide..
=> Show"N"Tell ( Your Machines)
-----------------------------
G-Code, CAD, and CAM
-----------------------------
=> G-Code, CAD, and CAM discussions
=> LazyCam (Beta)
-----------------------------
Third party software and hardware support forums.
-----------------------------
=> LazyTurn
=> GearoticMotion Preliminary testing
=> Tempest Trajectory Planner
=> Contec
=> dspMC/IP Motion Controller
=> HiCON Motion Controller
=> Third party software and hardware support forums.
=> Galil
=> Newfangled Solutions Wizards
=> Mach3 and G-Rex
=> Mesa
=> Modbus
=> NC Pod
=> PoKeys
=> SmoothStepper USB
=> Sieg Machines
=> Promote and discuss your product
-----------------------------
Tangent Corner
-----------------------------
=> Tangent Corner
=> Competitions
=> Polls
=> Bargain Basement
-----------------------------
Support
-----------------------------
=> Downloads
===> XML files
===> Post Processors
===> Macros
===> Tutorials
===> Others
===> Beta Brains
===> Screen Sets
===> Documents
===> MACH TOOL BOX
=> One on one phone support.
=> Forum suggestions and report forum problems.
-----------------------------
Mach4
-----------------------------
=> Mach4 pre-Alpha Testing
Loading...