I've recently upgraded from an ST10F168 to ST10F272 I made a fresh project and in that with the following settings i can use library functions putchar , and puts But I can not use "printf", if I use printf then only first character gets displayed on the hyper terminal. my settings are as follows H/ W settings crystal = 4Mhz P0H.7,6,5 = 1,0,0 ..resp. so my CPU freq = 20 Mhz my code is as follows #include <reg167.h> #include <stdio.h> #include <intrins.h>
void serial_setup (unsigned int baud) { S0BG = (20000000 / (32*(unsigned long) baud)) - 1; /* baudrate reload */ DP3 |= 0x0400; /* Set TXD for output */ DP3 &= ~0x0800; /* Set RXD for input */ P3 |= 0x0400; /* Set TXD high */ // tx_restart = 1; /* Set restart flag */ S0CON = 0x8011; S0RIC = 0x0044; /* Enable serial receive interrupt level 1 */ S0TIC = 0x0080; /* Enable serial transmit interrupt level 2*/ }
void main (void) { serial_setup (19200);
IEN = 1; /* Enable interrupts */ puts("i am here"); printf("Serial I/O Initialized\n"); while (1) { char c; c = getchar (); } }
Please read the instructions on how to post source code: www.danlhenry.com/.../keil_code.png
Note that TABs don't work (well) - use spaces instead,
and don't forget to check it in the 'Preview'...