Shop OBEX P1 Docs P2 Docs Learn Events
DAC virtual machine ability — Parallax Forums

DAC virtual machine ability

GJGJ Posts: 19
edited 2006-11-18 18:37 in General Discussion
Hello

I need to make a feedback control circuit. I will bring in a low voltage singal into an A/D and read it into the Javelin. Based upon that value, I will compensate and use the DAC to output the corrected value. I was going to use just the 1K, 1uF filter suggested in the manual, and that signal will go to a 10K resistor into an op amp with a 15K feedback resistor(1.5x gain).· Hopefully, this gives me a 0 to 7.5v DAC with a 255bit resolution.

My only real concern is response rate.· I will need to update the analog voltage at least 30x per second (it is synced to a video camera) The output from frame to frame may only change by 30mv or by 2 volts.

Has anyone worked with the DAC before and does my attempt seem reasonable?

The circuit is essentially an automated brightness control. I will sample the light coming from my light source with a photodiode in front of a camera. The analog voltage will drive the brightness of the light(it is actually the output of an X-Ray system)·which ideally should keep the image at the same brightness, even if something semi-radiotranslucent passes through the X-Ray beam.

If I can update at 30hz, the system will work. Yes, the stamp will have other jobs to do in the loop, but I am working to give the automated brightness control software priority. The other thing the stamp will need to do is communicate via rs232 to a pc.

Thanks

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-11-16 06:35
    The attached program has the basic setup.
    The implemented conversion settles for an adc input value of 127.
    I am not quite sure wether you want to have a setvalue for your light source
    (eg. dac output).

    The ADC converts its input signal every 2.2msec in the background.
    Its value() method just reads out a native register.
    The DAC update() method merely writes a native register.
    So 30Hz update should be no problem, except when you need to do
    alot of string processing handling the pc serial connection, but that
    can be split up in smaller pieces I guess, interleaving with DAC updates.

    regards peter

    Post Edited (Peter Verkaik) : 11/16/2006 6:59:30 AM GMT
  • GJGJ Posts: 19
    edited 2006-11-18 18:12
    Thank you, the DAC works pretty good. I also like the idea of just setting the midpoint. I was going to do some other calculations, but if is simply scale my input such that a DAC count of 127 provided me the correct light input to my camera, bingo, it will work well.

    I was pretty impressed with how well it actually worked. Depending on how much AC one can accept, the slew rate can be 5V/ms and the Javelin can update this value pretty quickly.

    I will take the output of the DAC filter into a 10K, then into an op amp. Do you think something like a .1uF cap to ground at the input to the op amp would reduce the AC component? From what I can see, the AC component is running at the 8.6uS machine cyle.

    It looks like it will work, I am hoping to test it with the completed X-Ray system within the next few weeks.

    Thanks

    George
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-11-18 18:37
    The ADC counts the number of '1' during 256 isr cycles
    (256*8.68usec = 2.2msec) where '1' means voltage at input pin above 2.5V

    I am not sure how the DAC works. It could set the output pin N isr cycles
    high and 256-N cycles low for a value N (N=0 to 255), or it interleaves
    high and low such that there are N high's during 256 isr cycles.
    In the first case the DAC period would be·2.2msec, even if N=128.

    Increasing the C will make changes to the DAC output, appear slower
    (lower cutoff frequency).

    regards peter
Sign In or Register to comment.