Hello Guest it is April 19, 2024, 04:24:07 AM

Author Topic: Can I Make OEMDRO Count?  (Read 4363 times)

0 Members and 1 Guest are viewing this topic.

Can I Make OEMDRO Count?
« on: May 10, 2007, 12:07:45 PM »
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?

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Can I Make OEMDRO Count?
« Reply #1 on: May 10, 2007, 04:42:43 PM »
Oh you want to decrement, in your email you weren't specific, instead put C=C-1 instead of the other.
fun times
Re: Can I Make OEMDRO Count?
« Reply #2 on: May 10, 2007, 05: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.

Offline poppabear

*
  • *
  •  2,235 2,235
  • Briceville, TN, USA
    • View Profile
Re: Can I Make OEMDRO Count?
« Reply #3 on: May 10, 2007, 07: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, 09:43:08 PM by poppabear »
fun times