1 #include <avr/io.h> // this contains all the IO port definitions
2 #include <avr/interrupt.h> // definitions for interrupts
10 #define SERIALDELAY 66
11 void serialdelay(void) {
13 for (timer
=0; timer
<= SERIALDELAY
; timer
++) {
19 void uart_putchar(char d
) {
21 cli(); // turn off interrupts, make it nice & kleen
25 for (i
=0; i
< 8; i
++) {
35 sei(); // turn on interrupts
39 void printhex(uint8_t hex
) {
42 uart_putchar(hex
+ '0');
44 uart_putchar(hex
+ 'A' - 10);
47 void putnum_uh(uint16_t n
) {
60 void putnum_ud(uint16_t n
) {
61 uint8_t cnt
=0, flag
=0;
63 while (n
>= 10000UL) { flag
= 1; cnt
++; n
-= 10000UL; }
64 if (flag
) uart_putchar('0'+cnt
);
66 while (n
>= 1000UL) { flag
= 1; cnt
++; n
-= 1000UL; }
67 if (flag
) uart_putchar('0'+cnt
);
69 while (n
>= 100UL) { flag
= 1; cnt
++; n
-= 100UL; }
70 if (flag
) uart_putchar('0'+cnt
);
72 while (n
>= 10UL) { flag
= 1; cnt
++; n
-= 10UL; }
73 if (flag
) uart_putchar('0'+cnt
);
79 void ROM_putstring(const char *str
, uint8_t nl
) {
82 for (i
=0; pgm_read_byte(&str
[i
]); i
++) {
83 uart_putchar(pgm_read_byte(&str
[i
]));
86 uart_putchar('\n'); uart_putchar('\r');
This page took 0.924866 seconds and 4 git commands to generate.