how to create a timer controlled analog-in command

Hi,

I have two separate question topics.  I am a relative newbie to programming in 
general, so please keep this in mind in your responses.

1.  I am trying to continuously read analog data from 5 channels of an 
NI-6036E board; my data are variable user inputs for a robot motion control 
system.  I have been able to continuously control my robot with something 
similar to the sample tut2.c and a few loops.

However, it is too slow.  I would like to be able to do this in a 
timing-controlled manner.  I would like to be able to specify the timing of 
the acquisition sequence and specify some time for computations and commands 
related to the motion control.

I am trying to understand cmd.c and use something similar to that.  I have 
read chapter 4 of the comedilib documentation, but it still doesn't completely 
make sense to me.  I would like to run comedi_to_phys(), but I don't have all 
of the arguments I need.  Is it possible to use the higher level commands, as 
in tut2.c, in a timing controlled manner?

In cmd.c, inside the loop where the data are printed, I don't really see how 
it associates the right channel with the corresponding voltage.

Also, I don't really know the most efficient way to add my serial commands to 
a file structured like cmd.c (or possibly a separate file using a makefile), 
and to specify the time allotted for those commands.

Does anyone have any other sample code that performs a similar function?  If 
so, please let me know how I can access it.



2.  I am getting somewhat different readings from Comedi than I am getting 
from my circuit output.  I am pretty sure I have everything properly grounded.
 I run comedi_calibrate every day when I start up the computer.  When I do not 
have my circuit powered, I get really strange results - definitely not zero 
volts.

Once I tried running comedi_calibrate with channels 1-5 directly shorted out 
to ground, separated from my circuit.  Then I connected my circuit to channels 
1-5.  I measured the voltage at the board with a voltmeter, where the circuit 
output is connected to the DAQ.  Then I ran inpn.c.  Here's my results:

Channel     Voltmeter Reading     Comedi Output (V)
   0               0.000               +2.720
   1              -0.061               -0.01358
   2              -0.075               -0.00931
   3              -0.066               -0.00961
   4              -0.058               -0.05234
   5              -0.062               -0.06821

My results were usually much larger voltages for the channels that were not 
connected to anything.

I will be working with voltages up to about 6-7 V, but it wasn't really 
convenient to use those for this test.  So I recorded the data from range 0 
(-10,+10 V).  In general, my output is not better from the lower ranges for 
the smaller input voltages.  I also tested some higher voltages in a similar 
manner, but I did not record the data.  When the voltage is in higher, e.g. 
5-6 V, there is still a considerable difference between the voltmeter reading 
and the Comedi output.

Thank you very much for your help with these issues.

Best Regards,

Heather Humphreys

Received on 2006-06-15Z22:26:43