continuous data acquisition from parallel port in

2019-08-03 11:19发布

问题:

For one of my projects, that is related to nerve conduction study, I need to acquire data continuously from a parallel printer port in Windows XP. The analogue data is processed by an Analogue to Digital converter and then serve it to parallel printer port. To get familiar with the data acquisition process I was trying to acquire data from a frequency signal generator that is connected to ADC and the frequency is set to 50 Hz. So far I have been able to read the data from PC using Java, but I'm worried that I'm making mistake somewhere.

The problem with the acquired data is, say for example, if I take first 500 data and plot it then I get a wave form but its not smooth enough indicating that the data is missing or scattered someway. I am giving a screenshot of a sample data plotting for 500data here . Hope someone can give me some hints where I am making mistake and show me some guidelines to solve it. Thanks in advance.

Sample code:

for (int i=0; i<500;i++) { 
      lpt.output(0x37a,32); //configures DR for data input by making C5bit of CR high
      lpt.output(0x37a,33); //starts data acquisition process by making C0 bit of CR high
      for(int j=0;j<1000;j++){     } //dummy loop to provide some time delay for ADC output to Stabilize
      arr[i] = lpt.input(0x378); // reading and storing the data in an array
      for(int k=0;k<10000;k++){} // dummy delay loop to provide sample data interval
}