Page 1 of 1

DAC work reverse

Posted: Mon Apr 15, 2019 7:43 am
by tancher
Hi,
I use code like these:

Code: Select all

     
u8_t  dac_value=0;    

dac_output_enable(DAC_CHANNEL_1);

while (1)
{
    dac_output_voltage(DAC_CHANNEL_1, dac_value++);
    delay(10ms);
}
On the oscillograph I see a falling saw on DAC1(GPIO25).

If I use next code

Code: Select all

     
u8_t  dac_value=0;    

dac_output_enable(DAC_CHANNEL_1);

while (1)
{
    dac_value++
    dac_output_voltage(DAC_CHANNEL_1, [color=#8000BF]~dac_value[/color]);
    delay(10ms);
}
I see a rising saw on DAC1(GPIO25).

Why DAC gives a reverse signal?

Re: DAC work reverse

Posted: Tue Apr 16, 2019 12:14 pm
by tancher
Must be: Setting it to 0 would result in 0V at the output pin, a value of 127 would be approx 1.65V at the output pin and 255 would be 3.3V.
And I get reverse value:
Setting it to 0 would result in 3V, setting it to 255 would result in 0V

Re: DAC work reverse

Posted: Tue Apr 16, 2019 5:09 pm
by fly135
Other than being surprised that HTML like constructs compile ok, I'm going with the tilde. :lol: