strange ao with dt2823

I seem to be getting strange D/A with the dt2823.  Interesting enough,
ao_waveform works with the driver, generating a nice sine wave at about
1.4V amplitude.  On further investigation, this was outputing values
between 0 and 4096, or 2^12.  The dt2823 is a 16 bit card though.
I wrote a small routine to output a sine wave with amplitude of 5V (or
zero offset of 16384), with offset zero centered at 32768.  I discovered
though that the output was not a sine wave but, 10V - 5*sin(x) for
positive sin, and -10V - 5*sin(x)) for negative sin, 10V being max out
for my card. considering all these output values are > 2^12.  As I
mentioned earlier, if output values remain < 2^12, it outputs a nice sin
wave.  Has anyone else come across something like this?

Another problem, when I start D/A in my application, it will output the
signal for a second, then flat line or minor noise for a few seconds,
then output continuously the right signal again.  What could be causing
this?  This doesn't happen in demo/ao_waveform, but I can't see any
noticeable difference in how my program writes and how ao_waveform does
it. This is how I did it (I followed the example in ao_waveform):

comedi_command(dev, &cmd);
write(comedi_fileno(dev), array, BUF_SIZE);
comedi_do_insn(dev, &insn);

while( 1 )
{
	n = BUF_SIZE;
	while(n>0){
		m=write(comedi_fileno(dev),(void*)array+(BUF_SIZE-n),n);
		if(m<0){
			perror("write");
			exit(0);
		}
		fprintf(stderr,"m=%d\n",m);
		n-=m;
	}
}


This just has me confused right now, any help would be appreciated.

Chris Angell

Received on 2002-05-28Z12:28:43