2 // Author: Bc. Jiri Kubias <Jiri.kubias@gmail.com>, (C) 2008
4 // Copyright: (c) DCE FEE CTU - Department of Control Engeneering
5 // License: GNU GPL v.2
10 * @file uart_minibee.c
11 * @author Bc. Jiri Kubias , DCE FEL CTU 2008
13 * @brief Uart library - particulary platform dependent
18 #include "MC1319xdef.h"
26 * Send one char to uart.
28 void uart_send_char(char val)
37 * Read one char from uart.
39 char uart_get_char(void)
48 * Initialize UART - platform dependent
53 init_uart0((int)9600, UART_BITS_8, UART_STOP_BIT_1, UART_PARIT_OFF, 0 );
59 * Send string to serial output in ASCII code. .
60 * @param data[] string to print
62 void send_rs_str(char data[])
68 for (j = 0; j < 255; j++)
70 if(data[j] == 0) break;
73 for (i= 0 ; i < j; i++)
75 uart_send_char(data[i]);
80 * Send int value to serial output in ASCII code. Removes unused zeros.
81 * @param val value to print
83 void send_rs_int(int val)
89 for(i = 0; i < 8; i++)
91 dat[i] = (val & 0xF) + 0x30;
97 for(i = 0; i < 8; i++)
99 if((pom == 0) & (dat[7-i] == '0'))
101 if((i == 6) | (i == 7))
106 uart_send_char(dat[7-i]);