Mail Archives: djgpp/1998/09/07/13:46:22
From: | brenner AT biochem DOT mpg DOT de (Markus Brenner)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Help with high-speed data aquisition
|
Date: | Mon, 07 Sep 1998 17:39:50 GMT
|
Organization: | Max-Planck-Institut fuer Biochemie
|
Lines: | 58
|
Message-ID: | <6t15sc$7es$1@fu-berlin.de>
|
NNTP-Posting-Host: | pcfr21.biochem.mpg.de (141.61.7.150)
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Hello,
what I'm trying to do is write a conversion program for old C64 tapes. The
tape recorder connects to an adapter at the parallel port. My program's task
is to read a certain status bit of the lpt port fast enough to detect changing
pulses and record pulse lengths. Eventually the program needs to save those
pulses to a file.
What I do right now is:
I go into a busy wait for detecting alternating up/down pulses, then I read
the timer to get the time delay since the last pulse. I store those into a
huge memory buffer and afterwards do the calculation of pulse lengths from
that data. Now, this all works pretty well except I got periodical wrong
information (pulses too long), due to interrupts. (pulse transition gets lost
during interrupt handling). See the code fragment at the end of the posting.
My question is: Can I turn off interrupts, and if yes, how? I could well
confine myself to use this tool under DOS, so I don't really have scrupels to
kill the multitasking :) OTOH I am not very familiar with protected mode and
memory management, can I still use large memory (needed for the buffer) if I
turn off interrupts?
Any help is appreciated!
cheers,
-markus
// set up timer
outp(0x43,0xb0);
outp(0x42,0xffff & 0x00ff);
outp(0x42,0xffff / 256);
status = inp(0x61);
outp(0x61,status | 1); // start the timer
bufferp = buffer;
while (!(inp(LPT) & sense_pin))
{
while (inp(LPT) & read_pin); // wait for '1' state
while (!(inp(LPT) & read_pin)); // wait for '1'->'0' state
*bufferp++ = inp(0x42); // store timer data to huge buffer
*bufferp++ = inp(0x42);
}
outp(0x61,status&~1); // stop timer
----
Markus Brenner _ no matter how - how hard you try
-==(UDIC)==- ( ) in your own life, and through the years
|\/| --+-- with every up - must come a down
\/ | enjoy the laughter and the tears
Minstrel Dragon | of happiness (Roger Taylor)
Lord High Mucketty-muck of the UDIC Greybeards (tm)
email: brenner AT biochem DOT mpg DOT de * WWW: http://www.biochem.mpg.de/~brenner/
- Raw text -