D
Dominik Wallner
Hi!
I'm currently implementing a program which measures voltages through an
external USB-AD-converter. It should output those values as time/voltage
pairs.
My problem is to measure the time to output (time elapsed since program
start would do just fine) - it should be as precise as possible, as
there may be only differences in milliseconds between two measurements.
Currently I'm using (clock()/float(CLK_TCK)) as time value, which is not
accurat enough as I get something like:
Time Voltage
0 0
0 0.062474
0 0.124792
0.01 0.186798
0.01 0.248337
0.01 0.309255
0.01 0.3694
0.02 0.428622
0.02 0.486773
0.02 0.543707
0.02 0.599282
0.02 0.653359
0.03 0.705803
0.03 0.756483
0.03 0.805272
0.03 0.852048
0.03 0.896695
0.04 0.939101
0.04 0.979159
0.04 1.01677
So I need a more precise way of measuring time differences. What
functions are available in C to do so? I'd like to keep my program as
portable as possible, but finally it should run only on a Windows/DOS
machine, so I can also use DOS-only functions if neccessary.
Thank you very much!
Yours,
Dominik Wallner
I'm currently implementing a program which measures voltages through an
external USB-AD-converter. It should output those values as time/voltage
pairs.
My problem is to measure the time to output (time elapsed since program
start would do just fine) - it should be as precise as possible, as
there may be only differences in milliseconds between two measurements.
Currently I'm using (clock()/float(CLK_TCK)) as time value, which is not
accurat enough as I get something like:
Time Voltage
0 0
0 0.062474
0 0.124792
0.01 0.186798
0.01 0.248337
0.01 0.309255
0.01 0.3694
0.02 0.428622
0.02 0.486773
0.02 0.543707
0.02 0.599282
0.02 0.653359
0.03 0.705803
0.03 0.756483
0.03 0.805272
0.03 0.852048
0.03 0.896695
0.04 0.939101
0.04 0.979159
0.04 1.01677
So I need a more precise way of measuring time differences. What
functions are available in C to do so? I'd like to keep my program as
portable as possible, but finally it should run only on a Windows/DOS
machine, so I can also use DOS-only functions if neccessary.
Thank you very much!
Yours,
Dominik Wallner