delay_ms(500);
//turn off transmitter/
output_low(PIN_E0);
delay_ms(500);
count = 0;
distance = 0;
event = 'r';
}
}
}
#int_rb
rb_isr ( )
{
// Initializing everything
byte changes;
int last_b;
int port_b;
changes = last_b ^ port_b;
last_b = port_b;
// if bob hit grain
if (!input(PIN_b6)){event = 'g';
}
// if bob is at housing
if (!input(PIN_b5)){event = 'h';
}
// if start
if (!input(PIN_b4)){event = 's';}
//debounce
delay_ms(100);
}
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Tue Apr 25, 2006 2:07 pm
"Urgent" probably means homework. But here's one small tip:
You have tons and tons of code which outputs the 'distance' to Port C.
Why not just do it with one line of code ? Like this:
Code:
output_c(distance);
Douglas Kennedy
Joined: 07 Sep 2003 Posts: 755 Location: Florida
Posted: Wed Apr 26, 2006 8:04 am
Yep it's getting to the end of the school year and this board will be expected to do term papers. Many might think that due to the large number of repetitive questions ( Ex RS232 issues) that the search function on this board must be broken.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum