We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
When I use printf, the uP hangs. When I use SBUF it owrks fine, what can be the problem ??? Hope someone can help me. I use an Atmel 89c52. Kindest regards, Ben Goofers #include <At89x52.h> /* special function register declarations */ #include <stdio.h> /* prototype declarations for I/O functions */ void main (void) { /*------------------------------------------------ Setup the serial port for 9600 baud at 11.0592MHz. ------------------------------------------------*/ TR1 = 0; SCON = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */ TMOD |= 0x20; /* TMOD: timer 1, mode 2, 8-bit reload */ PCON &= 0x7F; TH1 = 0xFD; /* TH1: reload value for 9600 baud @ 11.0592MHz */ // EA = 1; // ES = 1; RI = 1; TI = 1; TR1 = 1; /*------------------------------------------------ Note that an embedded program never exits (because there is no operating system to return to). It must loop and execute forever. ------------------------------------------------*/ printf ("hallo\r"); <=- with this line it doesn't work anymore !!!!!!!!!!!!!!!!! while (1) { TI = 0; SBUF = 'A'; while (!TI); P1 ^= 0xFF; TI=0; SBUF = '*'; while (!TI); TI=0; SBUF = '\r'; while (!TI); } }