Author Topic: continuous data acquisition using parallel port in java  (Read 24788 times)

xihad

  • Member
  • ***
  • Posts: 5
continuous data acquisition using parallel port in java
« on: October 08, 2011, 05:05:10 am »
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:

Code: [Select]
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] = 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
}

I m using jnpout32.dll from : http://www.hytherion.com/beattidp/comput/pport.htm
sample output image:

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: continuous data acquisition using parallel port in java
« Reply #1 on: October 08, 2011, 02:34:36 pm »
The port reads won't be at a fixed rate. If you need to sample data at a fixed rate, program a microcontroller to sample the data and send the results to the PC for further processing.

Jan

xihad

  • Member
  • ***
  • Posts: 5
Re: continuous data acquisition using parallel port in java
« Reply #2 on: October 19, 2011, 03:11:26 am »
HI Jan,

Thank you very much for the response!
Probably I didn't get your answer quite well as I am a complete newbie with parallel port. So far i understand, ADC used is doing the sampling task and I am just reading the data at a certain interval. to be specific , i need to acquire 2000 data in 100 ms . That means i need to read data with a 50 microsecond interval. Do you think that it can be done with a parallel port under windows xp environment. if yes, then what could be the best approach to achieve that. Thanks again.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: continuous data acquisition using parallel port in java
« Reply #3 on: October 19, 2011, 11:16:57 am »
To acquire data at this rate, I would suggest an external microcontroller programmed to collect the data and send the data to a PC via USB or Ethernet.

If you want to program the device in Java, see:

http://www.systronix.com/tstik/

Jan
« Last Edit: October 19, 2011, 12:33:23 pm by Jan Axelson »

xihad

  • Member
  • ***
  • Posts: 5
Re: continuous data acquisition using parallel port in java
« Reply #4 on: October 22, 2011, 02:52:03 am »
Jan,
thanks again!
yes i understand that USB data transfer is the best way to do what i want to achieve. but my project is such that i need to try it in parallel port. that's why i m asking about parallel port again and again. :(
really appreciate your help. tc