??? 12/21/08 14:53 Read: times |
#161094 - Keil printf disables output ? |
I´m using the latest Keil uVision IDE in connection with ADIs original ADuC814 eval board.
The Board is communicating fine at 9600-8-N-1 with no additional code at 16MHz CPU clock. I have written some programs that read in and put out analog data as well as port based digital I/O. Now the following problem: if there is a program that reads in ADC data and outputs it to UART using printf everything works fine. When I try to do an additional output of this data to one of the DACs, the DAC isnt working anymore. The other way around: I can read in ADC and put it out the DAC and it works. As soon as Im using printf the DAC will stop working but ADC and printf will continue working correctly I inserted a condition so that fprint gets first used after some time to find out if it is really printf or some other stdio related stuff, but DAC output works the first time until printf is used the first time Please see below a very small example to illustrate the effect. The code will output a saw- tooth wave on DAC0 if printf was commented out. If printf is in place the DAC0 output "hangs" on random voltage but printf/UART is working fine #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);} } Any ideas what printf is doing there to disable the DAC output ? Or is printf/putchar using some ressource that disables output ? BTW: this also works with ports, I can trigger P1.1 and it works as long as I call printf the first time. This is strange since the program and data input keeps working but any output seems to be frozen somehow |
Topic | Author | Date |
Keil printf disables output ? | 01/01/70 00:00 | |
Cross post | 01/01/70 00:00 | |
Keil printf disables output ? | 01/01/70 00:00 | |
Keil printf disables output ? | 01/01/70 00:00 | |
Not solved? | 01/01/70 00:00 | |
printf slows I/O interrupt | 01/01/70 00:00 | |
unlikely to disable IRQs | 01/01/70 00:00 | |
you can use your own putchar() function with Keil | 01/01/70 00:00 | |
you can use your own putchar() function with Keil![]() | 01/01/70 00:00 |