2 A simple test app for ds390 compiler work
7 typedef unsigned char byte;
8 typedef unsigned int word;
9 typedef unsigned long l_word;
11 code char my_message[] = {"Testing 123\n"};
12 volatile byte hi_flag = 1;
13 volatile byte timer = 0;
16 Note(Bug?): stock mcs51 will find this in library routines,
18 if this is not here linker does not link in
19 anything and does not complain or fail the link.
21 unsigned char _sdcc_external_startup ()
26 /*------------------------------------------------------------------------
27 timer0_int - Timer0 interrupt. Notice we are using register bank 2
29 |------------------------------------------------------------------------*/
30 void timer0_irq_proc(void) interrupt 1 using 2
42 TR0 = 0; /* Stop Timer 0 counting */
44 TL0 = (~(5000)) & 0xff;
45 TR0 = 1; /* Start counting again */
49 /*------------------------------------------------------------------------
50 uart0_int - Interrupt 4 is for the UART, notice we use register bank 1
51 for the interrupt routine.
52 |------------------------------------------------------------------------*/
53 void uart0_int(void) interrupt 4 using 1
63 /*------------------------------------------------------------------------
64 tx_char - transmit(tx) a char out the serial uart.
65 |------------------------------------------------------------------------*/
74 /*------------------------------------------------------------------------
75 tx_str - transmit(tx) a string out the serial uart.
76 |------------------------------------------------------------------------*/
77 void tx_str(char *str)
84 /*------------------------------------------------------------------------
85 main - Simple test program to send out something to the serial port.
86 |------------------------------------------------------------------------*/
89 PCON = 0x80; /* power control byte, set SMOD bit for serial port */
90 SCON = 0x50; /* serial control byte, mode 1, RI active */
91 TMOD = 0x21; /* timer control mode, byte operation */
92 TCON = 0; /* timer control register, byte operation */
94 TH1 = 0xFA; /* serial reload value, 9,600 baud at 11.0952Mhz */
95 TR1 = 1; /* start serial timer */
97 TR0 = 1; /* start timer0 */
98 ET0 = 1; /* Enable Timer 0 overflow interrupt IE.1 */
99 EA = 1; /* Enable Interrupts */
101 TI = 0; /* clear this out */
102 SBUF = '.'; /* send an initial '.' out serial port */
104 //ES = 1; /* Enable serial interrupts IE.4 */
112 tx_str("Hi There\n");