Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Exiting a subroutine without using return?

Status
Not open for further replies.
davepusey said:
Now i need to superimpose RUNSEQ and RUNSEQ2 storing result in W. By superimpose i mean like this...

Code:
RUNSEQ        10001000
RUNSEQ2       01000100

Result in W   11001100

I thought i could use an OR but i cant seem to figure it out. Your help would be helpful (yet again)!

How about:
Code:
movf   RUNSEQ, w
iorwf   RUNSEQ2, w
 
:idea:

Another method of goto'ing (does that sound right??) from a subroutine is to use a flag...... ok an example is in order.....


MAIN
CALL GET_RS232 ;CALL OUR RS232 SUB

BTFSC FLAG,NO_RS232 ;DID WE GET ANY RS232?
GOTO RS232_BAD ;NO, SO GO AND DEAL WITH IT

..... REST OF MAIN


GET_RS232
BCF FLAG,NO_RS232 ;CLEAR NO_RS232 FLAG

.............. CODE TO CHECK FOR RS232
.............. IF NONE, THEN SET THE FLAG

RETURN



ok, so it's not strictly a "goto" from a subroutine, but you get the idea, this method can be usefull, for example, if we are sitting in a subroutine that wait for 1 sec, but we want to detect a switch to end the subroutine...... we can set a flag for the switch then return......

Hope this helps :wink:
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top