Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 05 Oct 1997 18:16:36 +0930
From:      Mike Smith <mike@smith.net.au>
To:        mdean <mdean@best.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: A world of unexplored pain. 
Message-ID:  <199710050846.SAA00411@word.smith.net.au>
In-Reply-To: Your message of "Sat, 04 Oct 1997 23:25:44 MST." <Pine.SGI.3.95.971004230439.6896A-100000@shellx.best.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> Please stop me if I am about to waste my time doing something that just
> isn't possible.   I have received a lot of conflicting arguments on
> wheter or not the following is possible (more importantly will it function
> as designed).  What I need is one or more 0-500Hz Square Waves generated at
> the output pins of and 8255 PPi.

It is unlikely that you will be able to do this adequately, but 
probably worth trying just as an educational lesson.

Bear in mind that while parts of the kernel are running with interrupts 
masked off, your code cannot run and your stepper pattern will suffer.

> called.  One reason to use a comuputer to do this instead of a custom
> controller is co$t the other is complexity. To properly control the motors
> the pulse train must be scaled from 0 to 500Hz and back down as it slows.

This is a standard feature on any halfway-decent stepper control board.

[HC11 stuff follows]
> This is not a standard feature on the 68hc11 even though it has nearly
> everything but the kitchen sink built in. 
> With a freebsd machine I am likely to be able to accomplish this and also
> set it up as a system where the target position can be changed in realtime,
> thus making it possible to cancel a command. I just cannot do this with the
> embedded equipment I have available (mc68hc11) because a) rti on the 68hc11
> don't run faster than 500hz (you need 1000hz for a 500hz square wave) and

Uh, excuse me.  A 1kHz interrupt gives you 2000 machine cycles between 
interrupts.  I don't know quite how bloated your code _is_, but you can 
certainly fit a lot in there.

> b) if the routine was dedicated then the rs232/485 interrupt would possibly
> cause a lot of jitter taking the commands while scaling the output. 

You should re-read the HC11 reference, particularly the section where 
they discuss interrupt priority.

> I guess Ideally I should combine AtoD drivers and digital
> output drivers into one so that they may share the same interrupt routine,

No.  Keep your functions separate.

> the real question for me is: If I use acquire_timer0(1000, myintr) what
> kind of jitter should I expect in delivery of those interrupts, i.e how far
> off center will myintr() get called from the every 1/1000 of a second mark?

This depends on what other interrupt and clock-sensitive activity is 
going on; several milliseconds is not an unreasonable figure.

mike





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199710050846.SAA00411>