Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: zephyr9900 on January 11, 2010, 12:46:36 AM

Title: Subroutine reps DRO?
Post by: zephyr9900 on January 11, 2010, 12:46:36 AM
I posted a question to a thread which I now realize is over in the VB subboard.  I just want a DRO that shows which iteration a gcode subroutine is on.

If you don't normally read the VB subboard, could you please take a look at http://www.machsupport.com/forum/index.php/topic,7030.msg90039.html#msg90039 ?

Thanks,

Randy
Title: Re: Subroutine reps DRO?
Post by: stirling on January 11, 2010, 10:43:42 AM
Hi

try dro 222 (as you have done). Then try it in single block mode. It'll count DOWN from L? to zero. How to run it out of single block mode? - stick a G4 P1 in the loop somewhere. Why? - I haven't the faintest idea - but it seems to work.

Cheers

Ian
Title: Re: Subroutine reps DRO?
Post by: HimyKabibble on January 11, 2010, 02:57:30 PM
Hi

try dro 222 (as you have done). Then try it in single block mode. It'll count DOWN from L? to zero. How to run it out of single block mode? - stick a G4 P1 in the loop somewhere. Why? - I haven't the faintest idea - but it seems to work.

Cheers

Ian

DROs only get updated about 10X/second.  So, if you want to make sure you have the latest value, you have to wait long enough to ensure the most recent update has occurrect before reading the DRO.  I'm hoping this will be fixed in v4....

Regards,
Ray L.
Title: Re: Subroutine reps DRO?
Post by: stirling on January 11, 2010, 05:14:12 PM
hmmmm - don't think this is the reason for this though ray. I tried this with a sub that took several seconds per iteration and the dro registered nothing. Yet with a dwell of just 1 ms all worked fine.

Cheers

Ian
Title: Re: Subroutine reps DRO?
Post by: zephyr9900 on January 11, 2010, 05:52:58 PM
Ian and Ray, thank you very much for your answers.  Adding a G04 P.1 did the trick.  My dwell is in seconds, and there seems to be a "floor" for dwell time, that specifying a smaller value doesn't decrease the dwell.  I did try G04 P.001, and setting dwell to ms and trying G04 P1, but that didn't shorten the dwell time any.

And even my little test program takes at least a second to run, so if the dwell wasn't necessary to trigger the DRO it should have had plenty of time for the DRO to update (that's what I didn't understand in the first place...)

I did notice that the counter decrements on the dwell, so placing the dwell at the beginning of the subroutine immediately decremented the counter and the final iteration was on cycle "0", but placing the dwell just before the M99 caused the last iteration to report cycle "1", decrementing to 0 when the program ended.

Randy
Title: Re: Subroutine reps DRO?
Post by: HimyKabibble on January 12, 2010, 12:21:03 AM
hmmmm - don't think this is the reason for this though ray. I tried this with a sub that took several seconds per iteration and the dro registered nothing. Yet with a dwell of just 1 ms all worked fine.

Cheers

Ian

That suggests it has something to do with the threading, and inserting a Sleep 1 would probably also work just as well.  All you need is something that forces a context switch, however briefly, back to the Mach foreground task to get the DROs updated.

Regards,
Ray L.
Title: Re: Subroutine reps DRO?
Post by: stirling on January 12, 2010, 05:13:38 AM
maybe... but all the other dros update no problem.
Title: Re: Subroutine reps DRO?
Post by: ger21 on January 12, 2010, 07:15:32 AM
hmmmm - don't think this is the reason for this though ray. I tried this with a sub that took several seconds per iteration and the dro registered nothing. Yet with a dwell of just 1 ms all worked fine.

Cheers

Ian


Could this be due to the lookahead? Same way that comment in the g-code are displayed well before that line is current?