Ports
April 18, 2014, 06:49:23 pm *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: SMF - Just Installed!
 
   Home   Help Search Login Register  
Welcome to the PORTS Forum. Please post your questions, answers, and comments relating to USB and other hardware interfaces in the appropriate forums below.

IMPORTANT! This forum is is moving to JANAXELSON.COM. The new site is live now. Try it: http://janaxelson.com/forum. Please update your bookmarks and links. After June 1, 2014, this forum will be available ONLY at janaxelson.com and links to content at lvr.com will no longer work. - Jan
Pages: [1]
  Print  
Author Topic: continuous data acquisition using parallel port in java  (Read 5532 times)
xihad
Member
*
Posts: 5


« on: October 08, 2011, 04: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:
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:
Logged
Jan Axelson
Administrator
Frequent Contributor
*****
Posts: 2041


WWW
« Reply #1 on: October 08, 2011, 01: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
Logged
xihad
Member
*
Posts: 5


« Reply #2 on: October 19, 2011, 02: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.
Logged
Jan Axelson
Administrator
Frequent Contributor
*****
Posts: 2041


WWW
« Reply #3 on: October 19, 2011, 10: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, 11:33:23 am by Jan Axelson » Logged
xihad
Member
*
Posts: 5


« Reply #4 on: October 22, 2011, 01: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. Sad
really appreciate your help. tc
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!