Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 12:57:31 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
| | |-+  Can I Make OEMDRO Count?
Pages: 1   Go Down
Print
Author Topic: Can I Make OEMDRO Count?  (Read 1258 times)
0 Members and 2 Guests are viewing this topic.
sunmix
Active Member

Offline Offline

Posts: 35


View Profile
« on: May 10, 2007, 11:07:45 AM »

Hi guys, i want to make a DRO count, let say from 100 count to the value of X, i've no idea what seems the problem 0.0, can you help me out? thanks!

Option Explicit
Declare Sub Sleep Lib "Kernel32" (ByVal dwMilliseconds As Long)
Dim X As Integer
Dim C
Sub main ()

X = getOEMDRO(1005)
For C = 100 To X
SetOEMDRO(1006,C)
Next C

End Sub

PS: As in i can see the moves from 100 to x, and i can see it reducing to x?
Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Offline Offline

Posts: 1,707


Briceville, TN, USA


View Profile WWW
« Reply #1 on: May 10, 2007, 03:42:43 PM »

Oh you want to decrement, in your email you weren't specific, instead put C=C-1 instead of the other.
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/
Ron Ginger
V4 Screen Contributor

Offline Offline

Posts: 568



View Profile WWW
« Reply #2 on: May 10, 2007, 04:28:54 PM »

This may be a problem. The call to SetOEMDRO is going to take some time before it appears on the screen. VB may keep running and count down before you even see a display, or maybe you will get a few random numbers as it counts down.

You need some kind of delay in the loop. Im not sure While Ismoving waits for DRO calls, but as a test maybe just add a loop like

For I= 1 to 10000
Next I

A sleep would be the best way to wait.

Logged
poppabear
S S SYSTEMS, LLC
Global Moderator
*
Offline Offline

Posts: 1,707


Briceville, TN, USA


View Profile WWW
« Reply #3 on: May 10, 2007, 06:39:53 PM »

If you need a pause between counts that is tied into mach, then put a:

code "G4 P#"     '# is some interger that is equal to seconds ie 1=one second
While IsMoving()
Wend

'Another option is you can call the "System clock" (see cypress manual), and do some time value statements that every so
'often or values of the clock, it will increment your counter.

'Or you could "SetTimer(0)" then call timer 0, and with case or if then statements at certain values increment your counter

Scott
« Last Edit: May 10, 2007, 08:43:08 PM by poppabear » 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/
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!