DAC work reverse

tancher
Posts: 2
Joined: Tue May 08, 2018 8:01 pm

DAC work reverse

Postby tancher » Mon Apr 15, 2019 7:43 am

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?

tancher
Posts: 2
Joined: Tue May 08, 2018 8:01 pm

Re: DAC work reverse

Postby tancher » Tue Apr 16, 2019 12:14 pm

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

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

Re: DAC work reverse

Postby fly135 » Tue Apr 16, 2019 5:09 pm

Other than being surprised that HTML like constructs compile ok, I'm going with the tilde. :lol:

Who is online

Users browsing this forum: Bing [Bot], Majestic-12 [Bot] and 108 guests