This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ADuC814 ... printf usage disables DAC usage ??

Im testing the uVision3 v8.16 IDE in connection with
ADIs original ADuC814 eval board. When driving the
DACs, everything works as long as IÂ'm NOT using
printf.

Does printf reset the DAC settings or something
like this ?

I inserted a condition so that fprint gets first used
after some time, it works the first time until printf
is used the first time, so i assume it is printf and
not global stdio that does the effekt

Please see the small example below. When removing the
printf command DAC0 will correctly output a sawtooth
wave but not anymore when the printf is included

...

#include <stdio.h>
#include <REG52.H>

sfr PLLCON = 0xD7; // PLL CONFIGURATION BYTE
sfr DACCON = 0xFD; // DAC CONTROL REGISTER
sfr DAC0L = 0xF9; // DAC0 DATA

unsigned char Output;

void main(void)
{

PLLCON = 0x00; // CPU 16.0MHz Clock
DACCON = 0xFF; // set both DACs: on, 08bit

while (1)
{

DAC0L = Output; Output++;

printf("%02bX \n",Output);
}

}

Parents
  • So what, exactly, does it do with that printf in there?

    You don't seem to have anything to control the timing of your output other than the time it takes to execute the loop.

    Obviously, printf - just like any other function - will take a certain time to execute.
    Obviously, therefore, adding printf - or any other function call - in your loop will affect the output.

    Is your serial output implementation polled, or interrupt-driven?

    Does the printf output appear correctly?

Reply
  • So what, exactly, does it do with that printf in there?

    You don't seem to have anything to control the timing of your output other than the time it takes to execute the loop.

    Obviously, printf - just like any other function - will take a certain time to execute.
    Obviously, therefore, adding printf - or any other function call - in your loop will affect the output.

    Is your serial output implementation polled, or interrupt-driven?

    Does the printf output appear correctly?

Children