rohail1
November 29th, 2010, 11:09 PM
i need help with this..its my only programming because i am in mechanical eng..need help asap
Hook up your simulator bort b (p0,1,2) to a traffic light and an interrupt to portc. The main program will simply function as a normal light leaving green on for a 2 second, then yellow for a 1 second, and then red for two seconds and repeat. It can then be interrupted by a passing ambulance with connected to portc. The main program will be interrupted and switch the light to red if dipswitch 0 is on and green if dipswitch 2 is on. This routine will simply turn the light to the appropriate color, wait for 2 seconds and then return to normal operations.
aleast 2 subroutines--delay and also inturrupt. Make sure to your STAF interrupt (for portc)
Hook up your simulator bort b (p0,1,2) to a traffic light and an interrupt to portc. The main program will simply function as a normal light leaving green on for a 2 second, then yellow for a 1 second, and then red for two seconds and repeat. It can then be interrupted by a passing ambulance with connected to portc. The main program will be interrupted and switch the light to red if dipswitch 0 is on and green if dipswitch 2 is on. This routine will simply turn the light to the appropriate color, wait for 2 seconds and then return to normal operations.
aleast 2 subroutines--delay and also inturrupt. Make sure to your STAF interrupt (for portc)