ASURO Library  2.80
print.c
gehe zur Dokumentation dieser Datei
1 /****************************************************************************/
51 /*****************************************************************************
52 * *
53 * This program is free software; you can redistribute it and/or modify *
54 * it under the terms of the GNU General Public License as published by *
55 * the Free Software Foundation; either version 2 of the License, or *
56 * any later version. *
57 * *
58 *****************************************************************************/
59 #include "asuro.h"
60 
61 
62 
63 /****************************************************************************/
102 void PrintInt (
103  int wert)
104 {
105  char text [7]; // "-12345"
106 
107  itoa (wert, text, 10);
108  SerPrint (text);
109 }
110 
111 
112 
113 /****************************************************************************/
141 void PrintLong (
142  long wert)
143 {
144  char text [12]; // '-'1234567891'\0'
145 
146  ltoa (wert, text, 10);
147  SerPrint (text);
148 }
149 
150 
151 
152 /****************************************************************************/
179 void UartPutc (
180  unsigned char zeichen)
181 {
182  UCSRB = 0x08; // enable transmitter
183  UCSRA |= 0x40; // clear transmitter flag
184  while (!(UCSRA & 0x20)) // wait for empty transmit buffer
185  ;
186  UDR = zeichen;
187  while (!(UCSRA & 0x40)) // Wait for transmit complete flag (TXC)
188  ;
189  UCSRB = 0x00; // disable transmitter / powersave
190 }
191 
192 
193 
194 /****************************************************************************/
224 void SerPrint (
225  char *data)
226 {
227  unsigned char i = 0;
228 
229  while (data [i] != 0x00)
230  UartPutc (data [i++]);
231 }
232 
233 /****************************************************************************/
264  const char *data)
265 {
266  char c;
267 
268  while ((c = pgm_read_byte(data)) != 0)
269  {
270  UartPutc (c);
271  data++;
272  }
273 }