www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/02/07:45:20

Message-ID: <35ED2E1C.769A6BCE@hrz.uni-bielefeld.de>
Date: Wed, 02 Sep 1998 13:38:05 +0200
From: oliver kuhlmann <okuhlman AT hrz DOT uni-bielefeld DOT de>
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Need help for asm
NNTP-Posting-Host: dhcp6-239.uni-bielefeld.de
Lines: 45
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi,

I assembled a little board with an 8bit-ADC. The ADC runs at 200KHz by
its own oscillator. When valid data appear on its output a flag goes
high for about 2 µS, then the ADC starts a new conversion.
To get the data by LPT1 I wrote some code like following. Unfortunately
it runs too slow on my 486DX40, to get the data on a rate of 200KHz.
Perhaps asm code will be fast enough. But how to code the loop and its
code inside by asm?

Olli



...
#define LPT1 0x3BC
#define MAXSAMPLES 1000000

char *sample;


void main (void)
{
    sample = new char [1000000];
    disable();                                            / disable all
int
    outport(LPT1 +2, 0x20);                    / tristates D0-D7 LPT1


/ unfortunately the loop is to slow
    for (int i = 0; i < MAXSAMPLES; i++)
    {
        while (! (inportb (LPT1 + 1) & 0x80));    / wait until S7 on
LPT1 (busy) goes up
        *sample[ i ] = inportb (LPT1);                 / get valid data
        while ( inportb (LPT1 +1) & 0x80);         / wait until S7 goes
down (new AD-conversion)
    }

    enable();
}




- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019