Download Full report - ECE - Cornell University

Transcript
MENU = main_menu;
display_menu = 0;
putchar(12);
end
else if (r_char == ' ');
// ignore all the space
else
begin
UDR0 = r_char;
r_buffer[r_index++] = r_char ; // add a character to the string
end
end
else
// Human pressed <enter>
begin
putchar('\n');
//use putchar to avoid overwrite
r_buffer[r_index] = 0x00;
//zero terminate
r_ready = 1;
//signal cmd processor
UCSR0B ^= (1<<RXCIE0) ;
//stop rec ISR -- clear rxc
end
end
/**********************************************************/
//UART xmit-empty ISR
ISR (USART0_UDRE_vect)
begin
t_char = t_buffer[++t_index];
if (t_char == 0)
// end of string?
begin
UCSR0B ^= (1<<UDRIE0) ; // kill isr -- clear tx enable
t_ready = 1;
// transmit done
end
else
UDR0 = t_char ;
//send the char
end
//**********************************************************
//Entry point and task scheduler loop
int main(void)
begin
initialize();
42