Hello Guest it is October 24, 2020, 01:27:59 PM

Author Topic: Is it possible to have an elapsed time display for VB code?  (Read 8083 times)

0 Members and 1 Guest are viewing this topic.

Offline Tarak

*
  •  227 227
    • View Profile
Is it possible to have an elapsed time display for VB code?
« on: April 15, 2007, 08:34:02 PM »
I have multiple buttons that run a different program each (see pic), is it possible to have a display that shows how long it has taken from start to finish for the VB script each time it is run.
The display I currently have will only display the time of a loaded program that runs.
Is there a way to do this?

Offline poppabear

*
  • *
  •  2,233 2,233
  • Briceville, TN, USA
    • View Profile
    • S S Systems, LLC
Re: Is it possible to have an elapsed time display for VB code?
« Reply #1 on: April 16, 2007, 07:08:14 PM »
Yea, here you go Darc:

'Drop you a User Dro numbered 1200 or what ever, change code below to reflect new number. I put some sample moves in for you to see, how it times how long the script takes to run the code, notice the get timer(0) is at the end of the script to give you culamative time.

settimer(0)

Code "G0 x2"
Code "G0 x0"
code "M30"
While IsMoving()
Wend

x=GetTimer(0)

SetUserDRO(1200,x)

'Scott
Commercial Mach3 & Mach 4, Design/Build/Retrofit CNC and Industrial machines.
http://www.ss-systems-llc.com/

Offline Tarak

*
  •  227 227
    • View Profile
Re: Is it possible to have an elapsed time display for VB code?
« Reply #2 on: April 16, 2007, 10:00:10 PM »
Thanks Scott.
Works beautifully, just what I was after.
Thanks again.

Offline Tarak

*
  •  227 227
    • View Profile
Re: Is it possible to have an elapsed time display for VB code?
« Reply #3 on: April 17, 2007, 05:28:49 PM »
Hi poppabear, just a quick question regarding the code, whenever I have the timer in my program, it works great.
The only problem I have found is that the spindle won't start, even though there is an M03 in the script.
During the running of the cycle, if I press esc it displays terminating script and then starts the spindle??????
If I remove the code the spindle works as per normal.......nah nah nah nah (twilight zone).
Any ideas

Offline poppabear

*
  • *
  •  2,233 2,233
  • Briceville, TN, USA
    • View Profile
    • S S Systems, LLC
Re: Is it possible to have an elapsed time display for VB code?
« Reply #4 on: April 17, 2007, 08:40:38 PM »
Hey Darc,

   there was some noise about, you can't (or shouldn't call), a macro from within a macro.
So, what I would do, is get the Output pin that your M3 controls and just control the output specifically.
i.e.

ActivateSignal(OUTPUT1)  'change to whatever output your M3 triggers.

'If that STILL, doesn't work, then the question becomes a "Art or Brian" question, since it may have something to do with
'how Mach parses the code or some other internal issue.

Scott
Commercial Mach3 & Mach 4, Design/Build/Retrofit CNC and Industrial machines.
http://www.ss-systems-llc.com/

Offline Tarak

*
  •  227 227
    • View Profile
Re: Is it possible to have an elapsed time display for VB code?
« Reply #5 on: April 17, 2007, 11:58:18 PM »
Thanks heaps, it works treat now..
Re: Is it possible to have an elapsed time display for VB code?
« Reply #6 on: April 26, 2007, 12:36:01 PM »
hey hi everyone, i've tried it in my mach, for example the code for Macro M3 is like this:

settimer(0)

Code "G0 x2"
Code "G0 x0"
Code "G4 P" & (getUserDRO(1001))

While IsMoving()
Wend
 
ActivateSignal(Output1)
x=GetTimer(0)

SetUserDRO(1002,x)

DRO 1001 is the time that i've set for it to count : for example 10 seconds.
DRO 1002 is the elapsed time that it would show after the action is completed.

When i type M3 on my MDI, it triggers the macro,
and during this process, it should be running for about 16-20seconds.
instead the DR0 1002 shows out 1.6164. what have I went wrong?

Offline poppabear

*
  • *
  •  2,233 2,233
  • Briceville, TN, USA
    • View Profile
    • S S Systems, LLC
Re: Is it possible to have an elapsed time display for VB code?
« Reply #7 on: April 26, 2007, 05:40:40 PM »
get you code, OUT, of the m3 macro, that is for spindle clockwise.

Make a Custom Macro, that you post after you post the M3 if you want them close together.

Scott
Commercial Mach3 & Mach 4, Design/Build/Retrofit CNC and Industrial machines.
http://www.ss-systems-llc.com/
Re: Is it possible to have an elapsed time display for VB code?
« Reply #8 on: April 27, 2007, 09:13:06 AM »
Scott,

I don't quite understand what do you mean, it was just an example, my real code was for controlling heights and delays for my oxy/plasma.

what did u mean by " Post after you Post the M3 if you want them close together"?

Offline poppabear

*
  • *
  •  2,233 2,233
  • Briceville, TN, USA
    • View Profile
    • S S Systems, LLC
Re: Is it possible to have an elapsed time display for VB code?
« Reply #9 on: April 28, 2007, 07:35:10 AM »
Look at your "G4" settings in your general config, make sure your pauses are set to seconds, not micro seconds.

I meant, after your g-code puts out a m3, the next m code should be this one that you want special stuff, it you want it tied close to your m3.

scott
Commercial Mach3 & Mach 4, Design/Build/Retrofit CNC and Industrial machines.
http://www.ss-systems-llc.com/