2013-06-11 12:47:29 +00:00
|
|
|
#include <avr/io.h>
|
|
|
|
#include <util/delay.h>
|
2013-06-12 13:31:48 +00:00
|
|
|
#include "uart.h"
|
2013-06-11 12:47:29 +00:00
|
|
|
|
|
|
|
void wait(uint8_t count) {
|
|
|
|
uint8_t i;
|
|
|
|
if(count == 0) count = 100;
|
|
|
|
for(i=0;i<count;i++) {
|
|
|
|
_delay_ms(10);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-12 13:31:48 +00:00
|
|
|
void uart_print_voltage(uint16_t x) {
|
|
|
|
uart_putc(48 + (x / 10000));
|
|
|
|
uart_putc(48 + (x % 10000 /1000));
|
|
|
|
uart_putc('.');
|
2013-06-12 22:13:53 +00:00
|
|
|
uart_putc(48 + (x % 1000 / 100 ));
|
|
|
|
//uart_putc(48 + (x % 100 / 10 ));
|
|
|
|
//uart_putc(48 + (x % 10));
|
2013-06-12 13:31:48 +00:00
|
|
|
}
|
|
|
|
|
2013-06-14 10:47:35 +00:00
|
|
|
void uart_print_uint8(uint8_t x) {
|
|
|
|
uart_putc(48 + (x / 100 ));
|
|
|
|
uart_putc(48 + (x % 100 / 10 ));
|
|
|
|
uart_putc(48 + (x % 10));
|
|
|
|
}
|
|
|
|
|
2013-06-12 13:31:48 +00:00
|
|
|
void uart_print_uint16(uint16_t x) {
|
|
|
|
uart_putc(48 + (x / 10000));
|
|
|
|
uart_putc(48 + (x % 10000 /1000));
|
|
|
|
uart_putc(48 + (x % 1000 / 100 ));
|
|
|
|
uart_putc(48 + (x % 100 / 10 ));
|
|
|
|
uart_putc(48 + (x % 10));
|
|
|
|
}
|
2013-06-11 12:47:29 +00:00
|
|
|
|
|
|
|
|