Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/21/04 14:48
Read: times


 
#77843 - RE: DAC doesn't work well.
Responding to: ???'s previous message

1) The ADC is 14 bit, unused nybble contains number of ADC the value was read from. The DAC is 14 bit, writing to upper nybble shouldn't do anything but in some cases may do. Strip the upper nybble. Also, don't depend on compiler truncating the int to byte, do it yourself. (casts are welcome)
2) The DAC may suffer from the same syndrome as in ADuC812 - for large changes doesn't change the output value all the way it's meant to. Workaround: write twice.

h=(byte) ( i>>8 ) & 0x0F;
l= (byte) i & 0xFF;
DAC0H=h;
DAC0L=l;
DAC0H=h;
DAC0L=l;

3) Don't switch DACCON every time you write to it. Do it once in the main loop. And SET it, not "OR" with current value (depending on the reset values and reading a SFR meant for writing is a bad idea)
4) Does the serial communication work? (is it really RXD and not SBUF? And what does the data sheet say about reading/writing SBUF when the communication flags aren't set?)
5) COMMENT YOUR CODE!!!



List of 8 messages in thread
TopicAuthorDate
DAC doesn't work well.            01/01/70 00:00      
   RE: DAC doesn't work well.            01/01/70 00:00      
   RE: DAC doesnt work well.            01/01/70 00:00      
   RE: DAC doesn't work well.            01/01/70 00:00      
   RE: DAC doesn\'t work well.            01/01/70 00:00      
      Serial transmission + output filter            01/01/70 00:00      
      RE: DAC doesn\\\'t work well.            01/01/70 00:00      
         RE: DAC doesn\\\\\\\'t work well.            01/01/70 00:00      

Back to Subject List