Shirleyz,
Main Loop simply refers to the entry / starting point of your program. The main loop will iterate through the code inside it, usually an infinite number of times until the PIC is powered down.
Code:
main:
sensor=portb&7
branch sensor,[MF,TL,MF,TL,TR,MF,TR,tr]
goto main
MF:
high lm
pauseus 2000
low lm
pauseus 2000
high rm
pauseus 1000
low rm
pauseus 1000
GOTO main
TL:
HIGH LM
PAUSEUS 1000
LOW LM
PAUSEUS 1000
HIGH RM
PAUSEUS 1000
LOW RM
PAUSEUS 1000
GOTO main
TR:
HIGH LM
PAUSEUS 2000
LOW LM
PAUSEUS 2000
HIGH RM
PAUSEUS 2000
LOW RM
PAUSEUS 2000
GOTO main
This is the main loop of your program. The code between main: and GOTO main will be executed over and over again until you tell it otherwise. Without a condition to enable it to jump out it's an infinite loop basically.
Trent Jackson
Bookmarks