- // Initialize UART asynchronous mode
- // BGR04 = 1666; // 9600 Baud @ 16MHz
- BGR04 = 832; // 19200 Baud @ 16MHz
- // BGR04 = 416; // 38400 Baud @ 16MHz
-
- // BGR04 = 2083; // 9600 Baud @ 20MHz
- // BGR04 = 1041; // 19200 Baud @ 20MHz
- // BGR04 = 520; // 38400 Baud @ 20MHz
-
- // BGR04 = 2499; // 9600 Baud @ 24MHz
- // BGR04 = 1249; // 19200 Baud @ 24MHz
- // BGR04 = 624; // 38400 Baud @ 24MHz
- SCR04 = 0x17; // 8N1
- SMR04 = 0x0d; // enable SOT3, Reset, normal mode
- SSR04 = 0x00; // LSB first
- PFR19 = (PFR19 & 0xFC) | 0x03; // enable UART: SIN,SOT for async. transfer
- EPFR19 = 0x00; // enable UART
-}
-
-void Putch4(char ch) /* sends a char */
-{
- while (SSR04_TDRE == 0); /* wait for transmit buffer empty */
- TDR04 = ch; /* put ch into buffer */
-}
-
-char Getch4(void) /* waits for and returns incomming char */
-{
- volatile unsigned ch;
-
- for(;;)
- {
-
- while(SSR04_RDRF == 0) /* wait for data received */
- HWWD = 0x00;
-
- ch = RDR04;
-
- if ((SSR04 & 0xE0) != 0) /* Check for errors PE, ORE, FRE */
- {
- SCR04_CRE = 1; /* Clear error flags */
- }
- else
- return (ch); /* return char */
- }
-}
-
-
-void Puts4(const char *Name2) /* Puts a String to UART */
-{
- volatile int i,len;
-
- len = strlen(Name2);
-
- for (i=0; i<strlen(Name2); i++) /* go through string */
- {
- if (Name2[i] == 10)
- Putch4(13);
- Putch4(Name2[i]); /* send it out */
- }
-}
-
-
-char Echo4(void) /* Echo UART and return ch */
-{
- char ch;
-
- Puts4("UART 4 receive: "); // send text to UART
- ch = RDR04; // readout character
- Putch4(ch); // send character to UART
- if (ch==13)
- Putch4(10);
-
- return (ch);
+ // Initialize UART asynchronous mode
+ BGR04 = 416; // 38400 Baud @ 16MHz
+ SCR04 = 0x17; // 8N1
+ SMR04 = 0x0d; // enable SOT3, Reset, normal mode
+ SSR04 = 0x00; // LSB first
+ PFR19 = (PFR19 & 0xFC) | 0x03; // enable UART: SIN,SOT for async. transfer
+ EPFR19 = 0x00; // enable UART