Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 12:23:04 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  VB and the development of wizards
| | |-+  Well this counter has officially got me stumped....please help a poor soul...
Pages: 1   Go Down
Print
Author Topic: Well this counter has officially got me stumped....please help a poor soul...  (Read 1564 times)
0 Members and 2 Guests are viewing this topic.
Darc
Active Member

Offline Offline

Posts: 177


View Profile
« on: October 06, 2007, 02:22:41 AM »

Any thoughts as to why I can't get this counter to display correctly?

SetOEMDRO(1214,Remain)
Code "M98 P1 L10"
Code "O1"
Code "Z[#1-[#1*2]]"
Remain= Remain - 1
SetOEMDRO(1214,Remain)
Code "M99"
Logged
Graham Waterworth
Administrator
*
Online Online

Posts: 1,665


West Yorkshire, England



View Profile WWW
« Reply #1 on: October 06, 2007, 09:01:17 AM »

Hummmmmmmm, yes it was a thought, not had a genuine one for a while.

The top and bottom of it is it will not work.

If it was a normal program it would look something like this :-

O0001
#1=1
M98 P2 L10
M30

O0002
G00 Z[#1-[#1/2]]
#1=[#1-1]
M99

The way you are doing it the sub dose not exist until the VB script creates it line by line.

Go back to the start and tell us what you are trying to do, there will be a way but I don't think this is it.

Graham.
« Last Edit: October 06, 2007, 09:16:41 AM by Graham Waterworth » Logged

G-Code is on the cutting edge

Autovalues Engineering, CNC machining specialists, Bradford, England
Darc
Active Member

Offline Offline

Posts: 177


View Profile
« Reply #2 on: October 06, 2007, 09:37:16 AM »

Thanks for the reply Graham.
Basically I'm trying to display in a DRO how many repitions of a sub routine remain using a script.
So to use your example program:

O0001
#1=1
M98 P2 L10
M30

O0002
G00 Z[#1-[#1/2]]
#1=[#1-1]
SetOEMDRO(1214,#1) ' I know this isn't correct syntax, but if it was, this is exactly what I was hoping I could do.
M99

Is it possible to display in a DRO the valueof a variable? e.g #1
Logged
Graham Waterworth
Administrator
*
Online Online

Posts: 1,665


West Yorkshire, England



View Profile WWW
« Reply #3 on: October 06, 2007, 09:52:46 AM »

What you can do is this :-

Set up a M code macro that reads the parameters from a M code call, e.g.

'M1010.m1s
Dim P as Integer
P=Param1()
SetOEMDRO(1214,P)
End

Then in your G_code call M1010 P#1

Not done this in a while but I think its right.

If it works, where do I send the bill  Grin

Graham.
Logged

G-Code is on the cutting edge

Autovalues Engineering, CNC machining specialists, Bradford, England
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Offline Offline

Posts: 1,707


Briceville, TN, USA


View Profile WWW
« Reply #4 on: October 07, 2007, 02:43:08 PM »

Darc,

Try this Make and put the macros 200 and 201 in your macro folder

O0001
#1=1
M98 P2 L10
M201          'reset counter macro after subroutine exits
M30

O0002
G00 Z[#1-[#1/2]]
#1=[#1-1]
M200          'counter macro
M99



'M200.m1s  counter Macro

Remain=GetOEMDRO(1214)
Remain=(Remain+1)
SetOEMDRO(1214,Remain)

'M201.m1s reset counter macro

SetOEMDRO(1214,0)


'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/
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Offline Offline

Posts: 1,707


Briceville, TN, USA


View Profile WWW
« Reply #5 on: October 07, 2007, 06:47:26 PM »

Oppsssssss,

   Darc, didnt pay attention to the dro range make that "SetUSERDRO(1214,x)"...........

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/
Darc
Active Member

Offline Offline

Posts: 177


View Profile
« Reply #6 on: October 09, 2007, 06:48:39 AM »

Thanks alot guys, it works well, I used Scotts M200 & M201, it took me a while to realise I needed
If IsLoading()Then
Else
******
End If

But it works great.
Thanks again.
Logged
Vogavt
Active Member

Offline Offline

Posts: 95


View Profile
« Reply #7 on: August 24, 2008, 07:20:58 PM »

So can we get the working code all in one place/post? Never having done this sort of thing, I don't know where to put what.  Really need this sorted out to help another poor soul...

Thanks in advance,

Vogavt
Logged
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!