1

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
}
Zihad
  • 352
  • 3
  • 21
  • 1
    Please show some relevant code. – Gabe Oct 07 '11 at 18:16
  • Dummy loops are not good ways to add delay. That is what [sleep()](http://download.oracle.com/javase/6/docs/api/java/lang/Thread.html#sleep%28long%29) is for. – unholysampler Oct 07 '11 at 19:01
  • The compiler might have remove your dummy loop since your not doing anything in them. – YMomb Oct 07 '11 at 19:15
  • Thank you guys for you kind comments. The code provides what i am doing to get data continuously from a parallel port. is there any better way to apply delay other than sleep() as it doesn't support delay less than one millisecond. what if i want to apply a delay in microsecond? thank you again. – Zihad Oct 07 '11 at 19:31
  • hellow all, i have tried changing delay time , but it didn't help that much. still searching for the problem and its solution. – Zihad Oct 08 '11 at 09:51
  • Try increasing the size of the array buffers. Maybe we are dropping some data. – Zecas May 23 '12 at 16:55

0 Answers0