Re: Signal generation on parallel port
From: Kasper Dupont (kasperd_at_daimi.au.dk)
Date: 11/19/04
- Next message: Norm Dresner: "Re: Signal generation on parallel port"
- Previous message: 7: "Re: trying to tar 4GB size files"
- In reply to: HLHL: "Signal generation on parallel port"
- Next in thread: Norm Dresner: "Re: Signal generation on parallel port"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 19 Nov 2004 14:31:17 +0100
HLHL wrote:
>
> I want to create square wave signal on parallel port with prorammable
> frequency between 10-100Hz.
>
> Can one of the Linux guru guide me what is the best way of generation of
> squeare wave with highest possible frequency stability regardless of the
> process load on the computer?
AFAIK the parallel port is not really designed for this kind
of signal. But of course it might still be possible. Changing
a line on the parallel port is so simple, that doing it from
an interrupt handler would be an acceptable solution. Depending
on the lack you can allow, it might be the only solution.
Before messing with kernel code, you should however try a user
mode implementation. Create a small program that will lock all
its pages in memory and use nanosleep in a loop. Before each
nanosleep call use gettimeofday to find out how long you need
to sleep. Alternatively you could use the tsc instead of
gettimeofday, on a single CPU system the tsc should be
perfectly accurate, some people have reported that gettimeofday
occationally acts weird.
When you program is working, and does not do anything horrible
like using all the CPU time, you can add a call to switch to a
real time scheduling class. That should give you the best
possible timing that can be achieved in user mode.
-- Kasper Dupont
- Next message: Norm Dresner: "Re: Signal generation on parallel port"
- Previous message: 7: "Re: trying to tar 4GB size files"
- In reply to: HLHL: "Signal generation on parallel port"
- Next in thread: Norm Dresner: "Re: Signal generation on parallel port"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]