I have built a PCB to read the value of an analog voltage by using the
parallel port.  The circuitry uses a Dual Slope A/D conversion.  In
order to make that conversion, I have to count how long a certain
time-interval is.  Therefore I generate a square wave of 109 kHz and try
to count that with the parallel port, this is what I do:

--> I set one bit of the parallel port, say A, high (for visualisation
on an oscilloscope)

--> then I need to count 10000 pulses, i do it with the following
C-routine:

void count(int time)
{
  int value = 0;
  int clock;

  while (value < time) {
    do
      {
       clock = inb(BASEPORT+1) & 0x80;
      }
    while (clock == 0);

    do
      {
       clock = inb(BASEPORT+1) & 0x80;
      }
    while (clock == 0x80);

    waarde++;
  }
}

--> Then I set the bit A back to zero.

So, that means that every time i call the function count(10000) I should
always see the same HIGH-time for bit A, and that's not what happening!
The HIGH-time for A isn't a constant.  I have also written a similar
program for the DOS environment and there it works just fine.  My
question is: how should I solve this problem in order to have the same
HIGH-time every time i invoke the count(10000) function?  How can i make
my analog voltage measurements more reliable?  Is real time linux the
solution or do there exist shorter and easier ways? 

I would like to mention that I'm a student and Real Time Linux is
totally new for me, so if there are easier ways to achieve my goal then
i would like to know.  If Real Time Linux is the only solution for my
problem then please explain me how I should change my program or how i
should set things up.

Thanks a lot!
Bart Vandewoestyne, engineer electronics student.

-- 
Bart Vandewoestyne              http://hello.to/MC303           
Hugo Verrieststraat 48          [EMAIL PROTECTED]
8550 ZWEVEGEM                   ICQ# 21275340
BELGIUM - EUROPE                nick: MC303
Phone: +32(0)56/75.48.11
-------------------------------------------------------------
"Der Horizont vieler Menschen ist ein Kreis mit Radius Null -- und das
nennen sie ihren Standpunkt."

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

Reply via email to