one odd behaviour and one question of extension as applied to cmd.c example

I've been reworking some code, and started with the demo "cmd.c" code as 
a base.  First, I extended it to grab 16 channels of data, as I happed 
to have a signal generator feeding a sine wave pattern to my 15th 
channel.  Now here's the odd behaviour:  the count numbers, when they 
drop to around 2000 or so, seem to wrap and suddenly jump up to 63,000 
or so.  Here's a paste of the results...

> 63430 2291 2900 2657 2070 2070 2070 2071 2070 2070 2069 2070 2071 2069 
> 62789 2071
> 63429 2373 2564 2632 2070 2069 2070 2071 2070 2070 2070 2070 2071 2070 
> 62883 2072
> 63429 2421 2391 2621 2070 2070 2070 2071 2070 2069 2070 2070 2070 2070 
> 62981 2072
> 63429 2461 2357 2611 2070 2069 2070 2071 2070 2070 2070 2070 2071 2070 
> 63085 2071
> 63430 2581 2362 2586 2070 2070 2070 2070 2070 2069 2070 2070 2071 2070 
> 63193 2072
> 63430 2660 2368 2574 2070 2069 2070 2071 2070 2069 2069 2070 2071 2070 
> 63303 2072
> 63430 2678 2373 2575 2070 2069 2070 2070 2070 2070 2070 2071 2071 2070 
> 63415 2072
> 63429 2668 2395 2590 2070 2069 2070 2071 2070 2069 2070 2070 2071 2070 
> 2087 2072
> 63429 2659 2409 2600 2070 2069 2070 2071 2070 2070 2070 2070 2070 2070 
> 2198 2072
> 63430 2655 2424 2600 2070 2070 2070 2070 2070 2070 2069 2070 2070 2069 
> 2309 2072
> 63429 2653 2496 2589 2070 2069 2070 2071 2071 2070 2070 2070 2070 2069 
> 2416 2072
> 63430 2651 2554 2581 2070 2070 2070 2071 2070 2069 2070 2070 2070 2069 
> 2521 2072
> 63430 2648 2570 2578 2070 2070 2070 2071 2070 2069 2070 2070 2070 2070 
> 2620 2072
> 63429 2575 2580 2573 2070 2070 2070 2070 2071 2070 2069 2070 2071 2069 
> 2713 2072
> 63429 2474 2590 2567 2070 2070 2070 2071 2070 2069 2070 2070 2070 2069 
> 2800 2072
> 63429 2431 2595 2565 2070 2070 2070 2071 2070 2070 2070 2070 2071 2070 
> 2879 2071
> 63429 2331 2660 2561 2070 2070 2070 2071 2070 2070 2070 2071 2070 2070 
> 2950 2072
> 63429 2163 2755 2556 2070 2070 2070 2070 2070 2070 2070 2071 2070 2069 
> 3011 2072
> 63429 2088 2792 2554 2070 2070 2070 2070 2071 2070 2070 2070 2071 2070 
> 3061 2072
> 63429 2210 2718 2564 2070 2070 2070 2071 2071 2070 2070 2070 2071 2070 
> 3098 2072
> 63429 2519 2567 2583 2070 2069 2070 2071 2071 2070 2070 2070 2071 2070 
> 3120 2071
> 63429 2675 2498 2590 2070 2069 2070 2071 2071 2069 2070 2070 2071 2070 
> 3132 2072
> 63430 2718 2472 2577 2070 2069 2070 2071 2071 2070 2070 2071 2071 2069 
> 3136 2071
> 63429 2753 2439 2546 2070 2069 2070 2070 2071 2070 2069 2070 2070 2070 
> 3134 2072
> 63429 2772 2422 2532 2070 2069 2070 2071 2070 2069 2070 2070 2071 2070 
> 3125 2072
> 63430 2773 2443 2547 2069 2070 2070 2070 2070 2070 2070 2070 2071 2070 
> 3106 2072
> 63429 2757 2521 2594 2070 2069 2070 2071 2070 2069 2070 2070 2071 2070 
> 3074 2071
> 63429 2746 2568 2620 2070 2069 2070 2070 2071 2069 2070 2071 2071 2070 
> 3027 2072
> 63429 2741 2537 2613 2070 2069 2070 2071 2070 2069 2070 2071 2071 2070 
> 2969 2072
> 63429 2735 2347 2567 2070 2070 2071 2070 2070 2070 2070 2070 2070 2069 
> 2900 2072
> 63430 2730 2217 2539 2070 2069 2070 2070 2071 2069 2070 2070 2071 2069 
> 2822 2072
> 63430 2725 2214 2537 2070 2070 2070 2071 2070 2069 2070 2070 2070 2070 
> 2737 2072
> 63430 2687 2422 2562 2070 2070 2070 2071 2070 2070 2070 2070 2070 2069 
> 2645 2072
> 63429 2651 2591 2581 2070 2070 2070 2071 2070 2070 2070 2070 2071 2070 
> 2545 2072
> 63429 2644 2632 2583 2070 2070 2070 2070 2070 2070 2070 2070 2071 2069 
> 2441 2071
> 63430 2697 2568 2574 2070 2070 2070 2071 2071 2069 2070 2070 2071 2070 
> 2333 2071
> 63429 2757 2501 2567 2070 2069 2070 2071 2071 2070 2070 2070 2070 2070 
> 2223 2071
> 63429 2775 2479 2564 2070 2070 2070 2071 2070 2069 2070 2070 2071 2070 
> 2111 2072
> 63429 2690 2472 2568 2070 2070 2069 2070 2071 2069 2070 2070 2070 2070 
> 63437 2072
> 63430 2569 2467 2571 2070 2070 2070 2071 2070 2070 2070 2070 2071 2070 
> 63324 2072
> 63429 2524 2467 2572 2070 2070 2070 2071 2070 2069 2070 2070 2071 2070 
> 63213 2072
> 63429 2608 2495 2568 2070 2069 2070 2071 2070 2069 2070 2070 2071 2069 
> 63104 2071
> 63429 2765 2536 2562 2070 2070 2070 2071 2070 2069 2069 2071 2070 2070 
> 62999 2071


You can see how the 2nd from last column suddenly wraps to a high number 
when it drops below 2000 or so.

OK - now clue #2.  I can also run the "tut2.c" example and get nice 
clean voltages out, which do not do this.   Here's some sample output 
(of just channel 15)...

> 000967 -5.27717V
> 001032 -4.95971V
> 001111 -4.57387V
> 001205 -4.11477V
> 001309 -3.60684V
> 001423 -3.05006V
> 001553 -2.41514V
> 001690 -1.74603V
> 001812 -1.15018V
> 001953 -0.461538V
> 002091 0.212454V
> 002231 0.896215V
> 002367 1.56044V
> 002500 2.21001V
> 002625 2.82051V
> 002740 3.38217V
> 002843 3.88523V
> 002936 4.33944V
> 003014 4.72039V
> 003073 5.00855V
> 003111 5.19414V
> 003131 5.29182V
> 003136 5.31624V
> 003132 5.2967V
> 003116 5.21856V
> 003081 5.04762V
> 003025 4.77411V
> 002949 4.40293V
> 002858 3.95849V


Note how when the sample drops below 2000 (or so) that's where we go to 
negative voltage.

What is going on here!?!  It's like a sign bit's not right!

OK now here's the REAL question.  I need to be using the 
comedi_command() style of DAQ to set up my card to do the timing, etc.  
But with comdei_command, it looks like I lose access to all these nice 
functions like comedi_get_maxdata(), comedi_get_range() and most 
importantly comedi_to_phys().  How can I use the comedi_command() type 
of DAQ, use read() to get my data, and still use comedi_to_phys()? 

Tim Holt
NACSE

Received on 2004-01-08Z04:57:45