Dmitry Kiryashov email (remove spam text)
Hello Clyde !
The long answer is yes ! ;) But it will be software implemented stack.
Let we reserve some byte array STACK , about 4 bytes for example.
So we can store 2 procedure addresses - Proc_1 and Proc_2 .
STACK = HIGH ( Proc_1 ) ; STACK = LOW ( Proc_1 ) ;
STACK = HIGH ( Proc_2 ) ; STACK = LOW ( Proc_2 ) ;
And we have some piece of code (SEMAPHORE) with one byte pointer
which point to position in STACK of next called address . If we wish
Proc_1 than POINTER=0 , in case of Proc_2 POINTER=2 etc. Certainly in
we should also have additional flags , but i don't discuss about it .
flags that indicate what task is active/down/... ) POINTER var is useful
what last Proc_ was called .
Finally, to call Proc_1 we do foolowing :
; First we should initialize STACK array
MOVLW HIGH Proc_1
MOVLW LOW Proc_1
; Main part - CALL Proc_1
CALL SEMAPHORE ;CALL Proc_1
; CALL Proc_2
CALL SEMAPHORE ;CALL Proc_2
MOVWF PCL ; It's hidden GOTO ;)
; There are ability to save PCLATH and any another registers if need
; before GOTO to called Proc_ .
That's all . I was thinking this idea to make multitasking with PIC ,
but I still haven't time to do it ;(((
P.S. I have interest to look any theoretical/practical ideas in this
See also: piclist.com/techref/microchip/ints.htm?key=multitasking
You must be a member of the
piclist mailing list
(not only a piclist.com member) to post to the