Download Full report - ECE - Cornell University
Transcript
while(1)
begin
if (time1==0){time1=t1; task1(); }
if (time2==0){time2=t2; task2(); }
end
end
//**********************************************************
//Task 1
input a string and print it
void task1(void)
begin
//print ad get another serial string
if (r_ready)
begin
enter_pressed = 1;
// read string which is now ready
sscanf(r_buffer,"%s",v);
if (r_buffer[0] == 0) v[0] = 0;
// set up procedure to get the next string input
// and read it using receive ISR
getstr_int();
end
end
//**********************************************************
//Task 2
print the meaasge and system time in seconds
void task2(void)
begin
// update sensor value
debug_led = debug_led ^ 1;
// blink LED on the prototype board
(PORTD.2)
PORTD = (debug_led<<2);
43