1 // Source by Philipp Krause under CC0 1.0
3 // A "Hello, World!"-Program. We use it to make the board
4 // output something that can not be mistaken for output
13 while(!(SCON0
& 0x02));
19 unsigned char _sdcc_external_startup(void)
21 // Disable watchdog timer
25 return 0; // perform normal initialization
30 unsigned long int i
= 0;
32 // Initialize I/O pins
34 XBR0
= 0x04; // UART0 on P0.0 and P0.1
35 P0MDOUT
= 0x01; // Set port P0.0 (Uart tx) to push-pull
36 XBR2
= 0x40; // Enable crossbar
38 OSCICN
= 0xc3; // Run at full 24.5 Mhz - gives better accuracy for baudrate
40 // Use PLL to get SYSCLK to 98 Mhz to get reliable 9800 baud
47 for (i
= 0; i
< 31; i
++) // Wait 5 µs
57 while (!(PLL0CN
& 0x10));
60 // Configure UART for 1200 baud, 8 data bits, 1 stop bit.
66 SCON0
|= 0x02; // Tell putchar() the UART is ready to send.
70 printf("Hello, World!\n");
71 for(i
= 0; i
< 147456; i
++); // Sleep