CAD CAM EDM DRO - Yahoo Group Archive

Re: Smart/Dumb box again... (CPU timing)

on 2001-02-28 14:22:17 UTC
Hi Dave,

That looks like a better way to delay, but what I'd really like is to
"watch for a time period to expire", that is, record the time at the
start of a step's calc, do the calc (variable time), flip the required
pins, delay for pulse width, then "wait around" until the specified
"period" (for step frequency) has expired. Then repeat the process.
the "calc" time may be for watching acceleration, or "rotating" a point
for Circular interpolations, and probably wouldn't be regular, hence the
need to "wait around" until the period was complete.

If you have a way to reduce "loop" tasks to just flipping bits, then the
"task stack" sounds workable. I haven't been able to reduce much!

Alan KM6VV


dkowalcz@... wrote:
>
> Alan,
>
> Not sure if I'll actually work on implementing this or not, but I'd
> like to keep time in terms of clock cycles on the CPU - similarly to
> how some PICs have a timing register incremented each cycle.
>
> The way TurboCNC handles interpolation is to check *each* axis at
> some regular interval (around 30kHz) and update if needed. For a
> smooth step rate, a much shorter update than the step rate is needed.
>
> I'd like to get away from that model and have a "task stack"
> instead, with the time until the most urgent task stored at the top of
> the stack. Really, since all the machine does is flip pins on, off,
> or check the state of a pin, it shouldn't be all that tricky. So with
> the time to wait until the next task, stored in ECX say, then here's a
> cheezy CPU delay:
>
> Tick: SUB ECX, $04 (1)
> JNZ Tick (3/1)
>
> That sucks, since it can only resolve to 1/4 the clock frequency.
> So making it a bit more clever by shifting down the odd bits:
>
> .80486
> :: Enter with ECX as number of clock cycles to wait ::
>
> Shift: MOV EDX,ECX (1)
> AND EDX,$03 (1)
> JZ Timer1 (3/1)
> SUB ECX,$07 (1)
> JMP Shift (3)
> Timer1: SUB ECX,$08 (1)
> NOP (1)
> NOP (1)
> Timer: SUB ECX,$04 (1)
> JNZ Timer (3/1)
>
> ::Code to be executed::
>
> So as long as the delay is at least 32 cycles long and less than
> 2^32, the step action should happen regularly within a clock cycle.
> (No interrupts!)
>
> On my 486-66, that works out to delays of around a minute to 0.5uS
> resolved to 15nS. With steppers, the pulse timing has to be pretty
> exact, but the times "in between" are fairly long by comparison - well
> long enough to calculate when to flip the pin again.
>
> I figure with some logic on top to run and check the COM port
> for data when there's time to spare (next event >1000 clocks or so)
> and so on, it ought to be pretty workable.
>
> Dave Kowalczyk
> Ames IA
>
> --- In CAD_CAM_EDM_DRO@y..., Alan Marconett KM6VV <KM6VV@a...> wrote:
> {snip}
> >
> > Work continues. Accurate timing is quite important; made easier by
> > having "complete control" of the box. Ideas?
> >
> > Alan KM6VV

Discussion Thread

dkowalcz@i... 2001-02-26 16:15:10 UTC Smart/Dumb box again... Alan Marconett KM6VV 2001-02-26 17:07:50 UTC Re: Smart/Dumb box again... Carlos Guillermo 2001-02-26 17:52:42 UTC RE: [CAD_CAM_EDM_DRO] Smart/Dumb box again... Doug Harrison 2001-02-26 17:56:59 UTC Re: [CAD_CAM_EDM_DRO] Smart/Dumb box again... ballendo@y... 2001-02-26 18:11:06 UTC Re: Smart/Dumb box again... ballendo@y... 2001-02-26 18:15:38 UTC Re: Smart/Dumb box again... ballendo@y... 2001-02-26 18:22:16 UTC Re: Smart/Dumb box again... Alan Marconett KM6VV 2001-02-26 18:51:30 UTC Re: Smart/Dumb box again... Jon Elson 2001-02-26 22:36:06 UTC Re: [CAD_CAM_EDM_DRO] Smart/Dumb box again... Brian Walsh 2001-02-27 01:49:53 UTC Re: [CAD_CAM_EDM_DRO] Smart/Dumb box again... Ray 2001-02-27 06:56:01 UTC Re: Re: Smart/Dumb box again... Ray 2001-02-27 07:02:58 UTC Re: Re: Smart/Dumb box again... Jon Elson 2001-02-27 12:06:54 UTC Re: [CAD_CAM_EDM_DRO] Smart/Dumb box again... Paul 2001-02-27 12:48:52 UTC Re: [CAD_CAM_EDM_DRO] Re: Smart/Dumb box again... Alan Marconett KM6VV 2001-02-27 14:56:27 UTC Re: Smart/Dumb box again... wanliker@a... 2001-02-27 16:52:05 UTC Re: [CAD_CAM_EDM_DRO] Re: Smart/Dumb box again... Brian Pitt 2001-02-27 23:05:10 UTC Re: [CAD_CAM_EDM_DRO] Re: Smart/Dumb box again... Tony Jeffree 2001-02-27 23:34:32 UTC Re: Smart/Dumb box again... Alan Marconett KM6VV 2001-02-28 00:01:08 UTC Re: Smart/Dumb box again... Alan Marconett KM6VV 2001-02-28 00:03:11 UTC Re: Smart/Dumb box again... Brian Pitt 2001-02-28 01:31:53 UTC Re: [CAD_CAM_EDM_DRO] Re: Smart/Dumb box again... Ian Wright 2001-02-28 01:53:10 UTC Re: [CAD_CAM_EDM_DRO] Re: Smart/Dumb box again... Jon Elson 2001-02-28 11:30:00 UTC Re: [CAD_CAM_EDM_DRO] Re: Smart/Dumb box again... dkowalcz@i... 2001-02-28 12:27:25 UTC Re: Smart/Dumb box again... (CPU timing) Paul 2001-02-28 12:34:49 UTC Re: [CAD_CAM_EDM_DRO] Re: Smart/Dumb box again... Alan Marconett KM6VV 2001-02-28 13:19:24 UTC Re: Smart/Dumb box again... Alan Marconett KM6VV 2001-02-28 14:01:49 UTC Re: Smart/Dumb box again... Alan Marconett KM6VV 2001-02-28 14:22:17 UTC Re: Smart/Dumb box again... (CPU timing) Jon Elson 2001-02-28 16:09:47 UTC Re: [CAD_CAM_EDM_DRO] Re: Smart/Dumb box again... Alan Marconett KM6VV 2001-02-28 17:01:00 UTC Re: Smart/Dumb box again... wanliker@a... 2001-02-28 17:36:33 UTC Re: [CAD_CAM_EDM_DRO] Re: Smart/Dumb box again... Henry H. Armstrong 2001-02-28 19:16:18 UTC Re: [CAD_CAM_EDM_DRO] Re: Smart/Dumb box again... Jon Elson 2001-02-28 23:26:29 UTC Re: [CAD_CAM_EDM_DRO] Re: Smart/Dumb box again... Matt Shaver 2001-02-28 23:42:56 UTC Re: [CAD_CAM_EDM_DRO] Re: Smart/Dumb box again... Jon Elson 2001-03-01 12:11:52 UTC Re: [CAD_CAM_EDM_DRO] Re: Re: Smart/Dumb box again... (CPU timing) Alan Marconett KM6VV 2001-03-01 12:16:26 UTC Re: Smart/Dumb box again... beer@s... 2001-03-02 08:41:47 UTC Re: Re: Smart/Dumb box again... (CPU timing)