Hi, Can any body help me how to calculate the DAC code that to be loaded in to DAC0L and DAC0L to obtain a variable voltage reference for ADC in the runtime??? rgds Deepak
"Can any body help me" Not if you don't say what specific chip you are talking about! You need to state the manufacturer name, and full part number (inlcuding prefixes, suffixes, etc). But first, what does the Datasheet say?
Hi, Really Sorry for the inconveinience. I am using the chip C8051F020 manufactured by Cygnal Integrated Products. The data sheet says you can change the value of ADC0H and ADC0L in order to change the output voltage. There is no other information how to calculate the value. The output voltage is updated when the high byte is written into or you can configure it to update automatically when the timer 3 or 2 overflow ocuurs. Thank you. Deepak
"The data sheet says you can change the value of ADC0H and ADC0L in order to change the output voltage. " You mean DAC0H and DAC0L. The datasheet says: "Each DAC has an output swing of 0V to (VREF-1LSB) for a corresponding input code range of 0x000 to 0xFFF." ie, an input code of 0x000 gives an output voltage of 0V; an input code of 0xFFF gives an output voltage of (VREF-1LSB). Input values between 0x000 and 0xFFF give output voltages in linear proportion between those two limits. The Input value is the "Digital" part of "Digital-to-Analogue" Note that the Input values are 12 bits - that's why two 8-bit registers are required; called DAC0L and DAC0H. Because there are two separate registers, you cannot write the 12-bit Input value in one go - so there has to be some way to define when the whole values is complete, so that the analogue output can be allowed to change. The datasheet defines the options for this. Hope that helps...
Dear Mr.Andy Neil, Thank you very much for your kind help Regards, Deepak