ADC/DAC with dc and sine wave voltages - negative input

A catchall for PSoC Mixed-Signal Array (microcontroller) discussions not captured by the other forums.

Moderator: ericb

ADC/DAC with dc and sine wave voltages - negative input

Postby Ryan on Sat Oct 28, 2006 12:10 pm

I am just getting started with PSoC's.

I am trying to read in a sine wave that is +/- 1V using ADC (I output the signal using DAC after I do some calculations on it so that I can get ready to do feedback control). I am having trouble understanding how to wire and reference the signal to correctly handle the negative portion of the sine wave. I am generating the signal with a function generator and reading the input and output using LABView and a DAQ card with breakout board. If I simply hook up the ground of the function generator and DAQ card to Vss, I get fairly clean signals, but the output of DAC is cutoff below 0.1V. I think that makes sense (the DAC output is actually shift up 0.1V, so the output is the top half of the sine wave from 0.1-1.1V). If I change the ground of the function generator/DAQ card to port 2-4 (external AGND) there is very little change (a tiny bump toward the negative portion of the sine wave develops, but it doesn't go below 0V). I also setup a voltage divider between Vcc and Vss. If I connect my function generator/DAQ ground to this 2.5V reference, I get a sine save that is going from +/- 1 V, but the output of the PSoC DAC is very noisy. Should I be going about this differently? Are any of these approaches close to the right way to do this? When it is all said and done, I want to be able to input and output sine waves as well as DC (step) inputs. Any suggestions would be appreciated. I have tried looking for entry level reading material on this subject, but haven't found any. So, I would appreciate references to good starting level training material for ADC and DAC as well.
Ryan
Bite-Size Cheese
Bite-Size Cheese
 
Posts: 22
Joined: Sat Oct 28, 2006 11:46 am

Postby graaja on Sat Oct 28, 2006 6:48 pm

Some points to consider.

1. How are you feeding the input signal to the PSoC? This should not be done with reference to Vss as the negative part of the input will be clipped. You have to bring out the internal AGND through a RefMux user module to an output pin and use this as the reference to the input.
2. Set the Data type of DAC and ADC to 2's compliment, so that you get proper -ve signal processing.
3. If the GND of the data acquisition card and Vss of the PSoC are common, you cannot measure the output of DAC with respect to AGND. When you attach the -ve probe to AGND, this will short AGND and Vss. This happens with an oscilloscope but I am not sure about the data acquisition card.
User avatar
graaja
PSoC Master
PSoC Master
 
Posts: 3084
Joined: Thu Dec 18, 2003 4:35 pm
Location: India

Postby Ryan on Sat Oct 28, 2006 8:52 pm

Thanks for your direction. Should I connect the DAQ card ground to the external pin that I route AGND to? Where should I ground the DAQ card to measure the PSoC DAC output?

Thanks again,

Ryan
Ryan
Bite-Size Cheese
Bite-Size Cheese
 
Posts: 22
Joined: Sat Oct 28, 2006 11:46 am

Postby Ryan on Sat Oct 28, 2006 9:14 pm

I ran AGND out to a pin through a refmux module like you suggested and then I hooked the ground of my function generator and DAQ card up to that pin. My DAQ card is reading its input using Referenced Single Ended, where the reference is now the PSoC AGND. The result is very similar to when I set up a voltage divider between Vdd and Vss and hooked my function generator and DAQ card grounds up to there: the negative portion of the sine wave is handled correctly, but the output wave is fairly noisy. Is there more I should be doing? Something else I can try?

Thanks again,

Ryan
Ryan
Bite-Size Cheese
Bite-Size Cheese
 
Posts: 22
Joined: Sat Oct 28, 2006 11:46 am

Postby jiml on Mon Oct 30, 2006 1:56 am

How much noise is fairly noisy?

You can try..

1. Shorten the cables between the func. gen, DAQ, and pSoc
2. Use shielded cable and/or twisted pairs
3. Add some filters

You might also want to see if you can simply generate a sine wave inside the pSoc and pipe it out the DAC....is the signal still have noise?

Sometimes daq cards for PC applications have odd input configurations. If you are lucky enough to have a schematic for the daq card you might want to make sure that the input configuration is really measureing the right voltage difference.

Finally....check the pSoc ADC, DAC UM configuration to make sure that both are using the same encoding. Specifically you will be interested in whether the UMs are setup for signed/unsigned in/out and whether the format is two's complement or offset-binary. If you take the value from the ADC (configured as 2's complement) and then assign it (or a computed result) to an unsigned variable you will get what appears to be huge noise because small negative results will instead look like large positive values!

jiml
jiml
The Big Cheese
The Big Cheese
 
Posts: 440
Joined: Tue Sep 27, 2005 2:35 pm

Postby Ryan on Mon Oct 30, 2006 6:39 pm

Thanks to Ganesh and jiml for their help. I am declaring victory. Setting up the DAQ card in differential mode and being careful to use twisted pairs for all connections has lead to results I am happy with. See the attached plot.
Attachments
noise_solved.png
noise_solved.png (29.34 KiB) Viewed 1726 times
Ryan
Bite-Size Cheese
Bite-Size Cheese
 
Posts: 22
Joined: Sat Oct 28, 2006 11:46 am

Postby jiml on Tue Oct 31, 2006 2:19 am

Yup....looks pretty good! Glad you got there...

jiml
jiml
The Big Cheese
The Big Cheese
 
Posts: 440
Joined: Tue Sep 27, 2005 2:35 pm

Postby graaja on Tue Oct 31, 2006 4:34 pm

Hi Ryan,

Sorry that I could not respond earlier, as I was out of office.

I am very glad to see that you have achieved very good results.
User avatar
graaja
PSoC Master
PSoC Master
 
Posts: 3084
Joined: Thu Dec 18, 2003 4:35 pm
Location: India


Return to PSoC1 General

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron