Hello there..Here I need a solution regarding to my programming..It seems like have no problem with the programming flow.but it is still does not working as I want. Here the description and sequence that I want:
1) PIC circuit have a switch and 2 LED
2) Initially, the redLED flashed
3) After click pressed button the green LED will be flashed,
4) After that we pressed again the red LED will be flashed again.
5) The procees will continue according to the button is pressed.


<code>
GreenLED VAR PORTB.3
RedLEd VAR PORTB.4
emergency VAR PORTB.5 'switch pin


main :

IF emergency = 1 Then ' switch pin = 5V(high)
GoSub onn
Else ' switch pin = 0V(low)
GoSub offf
EndIF
GoSub main

onn:
High GreenLED
Low RedLED
Return

offf:
Low GreenLED
High RedLED
Return
</code>