- 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);
-}
-
-void Puthex4(unsigned long n, unsigned char digits)
-{
- unsigned char digit=0,div=0,i;
-
- div=(4*(digits-1)); /* init shift divisor */
- for (i=0;i<digits;i++)
- {
- digit = ((n >> div)&0xF); /* get hex-digit value */
- Putch4(digit + ((digit < 0xA) ? '0' : 'A' - 0xA));
- div-=4; /* next digit shift */
- }
-}
-
-void Putdec4(unsigned long x, int digits)
-{
- int i;
- char buf[10],sign=1;
-
- if (digits < 0) { /* should be print of zero? */
- digits *= (-1);
- sign =1;
- }
- buf[digits]='\0'; /* end sign of string */
-
- for (i=digits; i>0; i--) {
- buf[i-1] = ASCII[x % 10];
- x = x/10;
+ 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*/
+ }