Searching \ for ' [PIC] call, main, goto, locations!' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'call, main, goto, locations!'.

No exact or substring matches. trying for part
PICList Thread
'[PICLIST] [PIC] call, main, goto, locations!'
2002\07\07@192007 by Kevinhoward

picon face
This may seem like a daft question!!!

Using MPLAB

I have written a routine based on time delays from an input pulse
which uses call, goto, instructions. Should the main routine be located
before or after the "called" subroutines?

Does it matter if the "goto" subroutine is before or after the main routine?

For example;

main
pulse1
      btfsc     portb,1
      goto     pulse1
      call       action1       ;should action1 be listed before or after
pulse1?

pulse2
      btfsc     portb,2
      goto     pulse2
      goto     light2           ;should light2 be listed before or after
pulse1?

pulse3
      btfsc     portb,3
      goto     pulse3
      call       delay1        ;should delay1 be listed before or after
pulse1?
;etc

      goto     main

      end

Thanks for your help in advance--Analogue electronics for 28 years but a pic
newbie!!!!! learning fast but can't seem to find some basic rules!!!

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\07\07@231423 by Richard Mellina

picon face
When you 'call', the location in the program is stored ("pushed") into the
'stack'. At the end of the subroutine is placed the 'return' instruction
which retrieves ("pops") the program location on top of the stack and goes
to it. When you use 'goto' the processor simply jumps to that location in
the program and runs from there. I hope this helped solve your problem. Good
luck.

{Original Message removed}

2002\07\09@183440 by Kevinhoward

picon face
rsill -

Thanks for your help--- and moreover taking the time to reply to a newbie to
pics!

You supplied me in 6 lines with what I had missed in the numerous pic
"learning " books I have purchased.

Thanks again

Kev

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...