#include "main.h"
int main(void)
{
char * ptr = "Hello world!";
char * np = 0;
int i = 5;
unsigned int bs = sizeof(int) * 8;
int mi;
char buf[80];
double pi = 3.14159265358979323846264338327950288;
Set_PLL(16, 4);
Set_Uart0(115200);
mi = (1 << (bs - 1)) + 1;
while(1)
{
printf("\n\n");
printf("Simple printf test\n");
printf("Press any key to start ...\n");
GetChar_Uart0();
printf("%s\n", ptr);
printf("termf test\n");
printf("%s is null pointer\n", np);
printf("%d = 5\n", i);
printf("%d = - max int\n", mi);
printf("char %c = 'a'\n", 'a');
printf("hex %x = ff\n", 0xff);
printf("hex %02x = 00\n", 0);
printf("signed %d = unsigned %u = hex %X\n", -3, -3, -3);
printf("%d %s(s)%%", 0, "message");
printf("\n");
printf("%d %s(s) with %%\n", 0, "message");
sprintf(buf, "justif: \"%-10s\"\n", "left");
printf("%s", buf);
sprintf(buf, "justif: \"%10s\"\n", "right");
printf("%s", buf);
sprintf(buf, " 3: %04d zero padded\n", 3);
printf("%s", buf);
sprintf(buf, " 3: %-4d left justif.\n", 3);
printf("%s", buf);
sprintf(buf, " 3: %4d right justif.\n", 3);
printf("%s", buf);
sprintf(buf, "-3: %04d zero padded\n", -3);
printf("%s", buf);
sprintf(buf, "-3: %-4d left justif.\n", -3);
printf("%s", buf);
sprintf(buf, "-3: %4d right justif.\n", -3);
printf("%s", buf);
sprintf(buf, "%.2f is a double\n", 3.31);
printf("%s", buf);
sprintf(buf, "multiple unsigneds: %u %u %2u %X\n", 15, 5, 23, 0xB38F);
printf("%s", buf);
sprintf(buf, "multiple chars: %c %c %c %c\n", 'a', 'b', 'c', 'd');
printf("%s", buf);
sprintf(buf, "multiple doubles: %.2f %2.0f %.2f %.3f %.2f [%-8.3f]\n", 3.31, 2.45, -1.1, 3.093, 13.72, -4.382);
printf("%s", buf);
sprintf(buf, "PI = %.10f\n", pi);
printf("%s", buf);
}
return 0;
}