Java并行口连续数据采集
我的一个项目与神经传导研究有关,我需要从 Windows XP 中的并行打印机端口连续获取数据。模拟数据由模拟数字转换器处理,然后将其提供给并行打印机端口。为了熟悉数据采集过程,我尝试从连接到 ADC 的频率信号发生器采集数据,频率设置为 50 Hz。到目前为止,我已经能够使用Java从PC读取数据,但我担心我在某个地方犯了错误。
获取数据的问题是,例如,如果我获取前 500 个数据并将其绘制出来,那么我会得到一个波形,但它不够平滑,表明数据丢失或以某种方式分散。我在 此处 给出了 500data 的示例数据绘制屏幕截图。希望有人能给我一些我犯错误的提示,并向我展示一些解决问题的指导方针。提前致谢。
示例代码:
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
}
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
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论