00001
00023 #include "xmodem.h"
00024
00025 extern struct global
00026 {
00027 volatile unsigned char *recv_ptr;
00028 volatile unsigned char buffer_status;
00029 volatile unsigned char recv_error;
00030 volatile unsigned char t1_timed_out;
00031 } gl;
00032
00033 void sendc(void) {
00034
00035
00036
00037
00038
00039
00040
00041 TCNT1 = 0xA472;
00042 TCCR1B = 0x00;
00043
00044
00045 gl.buffer_status = empty;
00046 gl.t1_timed_out = FALSE;
00047 gl.recv_error = FALSE;
00048
00049
00050 while (!gl.buffer_status)
00051 {
00052
00053 while (!(UCSR0A & 0x20));
00054 UDR0 = CRCCHR;
00055 TCCR1B = 0x05;
00056
00057
00058 while (!gl.t1_timed_out && !gl.buffer_status);
00059
00060
00061 TCCR1B = 0x00;
00062
00063 if (gl.t1_timed_out)
00064 {
00065 gl.t1_timed_out = FALSE;
00066 TCNT1 = 0xA472;
00067 }
00068 }
00069 }