Greater than 8bit D to A converter?
Hello,
I'm using SX/B and see that the PWM command can be used as a 8 bit D to A converter.
What can I do if I need greater sesolution than 8 bit? say 10 bit, or maybe 12?
Everyone seems to point to the PWM command, but are there 10 or 12 bit DAC chips?
I guess these would use the SERIN and SEROUT command to control them?
Thanks,
Alex
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
If at first you don't succeed, then skydiving is not for you.
I'm using SX/B and see that the PWM command can be used as a 8 bit D to A converter.
What can I do if I need greater sesolution than 8 bit? say 10 bit, or maybe 12?
Everyone seems to point to the PWM command, but are there 10 or 12 bit DAC chips?
I guess these would use the SERIN and SEROUT command to control them?
Thanks,
Alex
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
If at first you don't succeed, then skydiving is not for you.
Comments
[noparse][[/noparse]edit] The AD5641 does require a well regulated input. It does NOT have an internal voltage reference.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.iElectronicDesigns.com
Post Edited (Bean (Hitt Consulting)) : 1/10/2008 4:12:45 PM GMT
I think he is looking for a DAC instead of an ADC.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.iElectronicDesigns.com
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
---
James Newton, Host of SXList.com
james at sxlist,com 1-619-652-0593 fax:1-208-279-8767
SX FAQ / Code / Tutorials / Documentation:
http://www.sxlist.com Pick faster!
Yes, SHIFTIN/SHIFTOUT is what I meant to say. That's what happens when I rely on my memory.
I looked at the datasheet for the LTC1257 and it looks like it has a voltage reference. Isn't the voltage reference to give it a sort of base voltage to work with which will make it more accurate?
A few lines of code would be great if it isn't too much trouble. I have the ADC8031 working on my SX Tech board and have that figured out, just haven't found anything on how to run a DAC converter in SX/B. I would assume its a sort of reverse process to the ADC, but using the SHIFTOUT command?
It looks like I would need to use a 12bit DAC, I now need to split the word variable into LSB and MSB to send the data to the DAC?
Alex
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
If at first you don't succeed, then skydiving is not for you.
Just curious - what do you need the extra bits of DAC resolution for?
Thanks,
PeterM
I'm all about keeping it simple and Jon says the LTC1257 chip is easy to use, so I'll try that first.
Alex
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
If at first you don't succeed, then skydiving is not for you.
If you are using the SX48, it actually has a 16bit resolution timer built into it. So, the coding would be more concis
There are at least three differnt hardware configurations for DAC. a resister ladder as presented in Guenter's text; R2R resistor networks; and Sigma-Delta configured as output. Also I believe the PWM may quality as a fourth that uses a filtering/smoothing network to get your output.
Each has its own pros and cons regarding how many pins it uses, how wide the frequency response is, and how smooth you output is.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
PLEASE CONSIDER the following:
Do you want a quickly operational black box solution or the knowledge included therein?······
Post Edited (Kramer) : 1/12/2008 1:02:22 PM GMT
Lately I have been getting much more familiar with the TIMER commad and learning the ins and outs of it, with help from this forum. I do have a few SX-48 boards and may try that and see how it works.
Thanks for the ideas. Keep 'em coming - I'm here to learn.
Alex
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
If at first you don't succeed, then skydiving is not for you.
I have a ask a question or two about the code you posted for reading the LTC1298.
I see the subroutine "FUNC RD_1298"· contains the actual communication with the ADC chip.
What does the rest of the program do? Is that all necessary to initialize the chip and understand its output? If that is the case using the LTC1298 is waaaayyy over my head. Or is the rest of the code for displaying the output in different forms of some kind? Hex and string?·I see the "TX" pin is used to transmit the data to a host. Would this host be another chip, or a LCD display?
Thanks for your help,
Alex
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
If at first you don't succeed, then skydiving is not for you.
the simplest DAC you can realize with the SX is a PWM output, filtered by an RC low-pass.
The 8-bit code looks like this:
Put these instructions inside a loop, or have them periodically executed by an ISR. The output signal (without the filter) will be a square wave with a duty cycle from 0 up to almost 100%, depending on the contents of DACVal. With the filter, the voltage across the capaitor will be from 0 to almost 5 Volts.
If you like, you can expand this into a 16-bit version like this:
Two bytes are here used for DACAcc and for DACVal. When the addition of DACAccL and DACValL overflows, i.e. when carry is set, you need to increment DACAccH by one. You can't use addb DACAccH, c, or inc DACAccH to achieve this because both instructions don't set the carry in case they cause an overflow in DACAccH. This is why I use w to add 1 to DACAccH when c is set.
If this version is good enough for your project depends on the response time you need, and the 16-bit version is a lot slower than the 8-bit version but you might give it a try.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
G
Thank you for the code. I've been using SX/B lately and never used assembly before. I do have your book and trying to understand your code from it. Just a few questions,
The DAC**** are all variables? Also I assume the DACOut is the name of the output pin?
Thank you,
Alex
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
If at first you don't succeed, then skydiving is not for you.
· Try this...
Since the interrupt rate is 2,000,000 the update rate is only about 30Hz (2,000,000 / 65536). So I hope to don't need the output to change rapidly.
Oh, and don't forget the resistor and cap on the output.
Bean
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.iElectronicDesigns.com
Post Edited (Bean (Hitt Consulting)) : 1/16/2008 5:49:41 PM GMT
yes, your assumptions regarding DACAcc, DACVal, and DACOut are right, and Bean's example nicely translates my cryptic assembly code into SX/B - thanks Bean!
As Bean pointed out, this DAC version has a pretty slow response-time. In case you want to generate fast output waveforms, like audio signals, this does not work. For such applications, you might consider using something like an R-2R ladder network, as I have described it in my book. Although my example is 8 bit only, it can also be expanded to more bits, but each bit costs one more SX output pin.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
G
Bean,
The program looks great, short and simple too. What I'm looking to do is read an input voltage with a ADC then· make a voltage output, either adding some voltage to it, or subtracting some voltage from the original. At first I was looking for a DAC chip to do this, but doing it with software seems much easier. I see your program runs an interrupt, will this cause any problems if I'm reading a ADC chip using SHIFTIN? Will the program slowdown when the SHIFTIN command runs? The calculations for adding/subtracting voltage would be only a few lines. The 30Hz update of your program is plenty fast, I would guess 10Hz may even be enough.
Guenther,
I did read the section in your book about the R-2R ladder network. I also read the Parallax book "Basic Analog and Digital" The description in it would be fairly straight forward to convert it to SX/B and add a few more bits of resolution. It looks fun to build just for good practice also.
Thanks again for the help,
Alex
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
If at first you don't succeed, then skydiving is not for you.
The interrupts will cause the SHIFTIN to be somewhat slower, but it shouldn't effect the data at all.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.iElectronicDesigns.com
·