continuous data acquisition from parallel port in Java

二次信任 提交于 2020-01-05 04:41:12

问题


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
}

来源:https://stackoverflow.com/questions/7691257/continuous-data-acquisition-from-parallel-port-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!