More BS2P40 concepts
Archiver
Posts: 46,084
Progress ! ! I am making small steps in bringing my R/C submarine project on
line. Added a few more hardware devices to the mix and a few still to go.
Couple questions.
Programs running in slots, are they stand alone programs that are exactly like
you would run in say the BS2IC?? How do you share variables among the slots??
Do I do a "return" from these slot applications??
In hardware interupt driven software when an interupt is recieved the service
routine disable interupts while processing the current INT so as to not over
flow the stack pointer. Does the same problem exist with the 2P polling?? Or
do the slots run independantly of the other processes and don't care if other
events occur while they are processing the evet they are interested in??
I fishing for concepts here, not specific examples per se.
So far I am loving this 40 pin chip, it's making my life a lot easier for the
radio control unit side. I plan on the 24 pin version in the sub itself as it
has less hardware to deal with so I can get by with less I/O.
Thanks for reading.
Mike B.
[noparse][[/noparse]Non-text portions of this message have been removed]
line. Added a few more hardware devices to the mix and a few still to go.
Couple questions.
Programs running in slots, are they stand alone programs that are exactly like
you would run in say the BS2IC?? How do you share variables among the slots??
Do I do a "return" from these slot applications??
In hardware interupt driven software when an interupt is recieved the service
routine disable interupts while processing the current INT so as to not over
flow the stack pointer. Does the same problem exist with the 2P polling?? Or
do the slots run independantly of the other processes and don't care if other
events occur while they are processing the evet they are interested in??
I fishing for concepts here, not specific examples per se.
So far I am loving this 40 pin chip, it's making my life a lot easier for the
radio control unit side. I plan on the 24 pin version in the sub itself as it
has less hardware to deal with so I can get by with less I/O.
Thanks for reading.
Mike B.
[noparse][[/noparse]Non-text portions of this message have been removed]
Comments
The slots in the BS2p are stand-alone programs and only one runs at any given
time. You can determine which slot is running the chip with the RUN x
directive.
If you're able to define your variables the same in all slots that you want
to run, you automatically share them since they are not changed when you move
from slot to slot. If you have a different set of variable definitions in
the slot you run next, all bets are off. What you can do in this case is
pass information through the SPRAM using PUT and GET. Remember that PUT and
GET work with bytes, so you'll have to use two PUTs and GETs to deal with a
16-bit variable.
While there's not enough SPRAM to do this for all eight slots, you can use
this bit of code to save all variables in a given slot to the SPRAM before
running another:
Push_Vars:
PUT (SlotStart + 25), B25
FOR B25 = 0 TO 24
PUT (SlotStart + B25), B0(B25)
NEXT
RETURN
I don't normally recommend using internal variable names, but this is an
exception that makes good sense. The code takes advantage of the inherent
array structure of PBASIC variable RAM. You'll have to define [noparse][[/noparse]as a
CONstant] SlotStart as the starting location in SPRAM where you will save
variables for the program current slot.
You can recover the variables with this code:
Pop_Vars:
FOR B25 = 0 TO 24
GET (SlotStart + B25), B0(B25)
NEXT
GET (SlotStart + 25), B25
RETURN
Remember that the BS2p polls pins between instructions if you set it up to do
so -- it is not a true interrupt. Polling is only active in the current slot
if you enable it.
I hope this information helps.
-- Jon Williams
-- Applications Engineer, Parallax
In a message dated 8/11/02 9:53:11 PM Central Daylight Time,
w6ffc@p... writes:
> Progress ! ! I am making small steps in bringing my R/C submarine project
> on line. Added a few more hardware devices to the mix and a few still to
> go.
>
> Couple questions.
>
> Programs running in slots, are they stand alone programs that are exactly
> like you would run in say the BS2IC?? How do you share variables among the
> slots?? Do I do a "return" from these slot applications??
>
> In hardware interupt driven software when an interupt is recieved the
> service routine disable interupts while processing the current INT so as to
> not over flow the stack pointer. Does the same problem exist with the 2P
> polling?? Or do the slots run independantly of the other processes and
> don't care if other events occur while they are processing the evet they
> are interested in??
>
> I fishing for concepts here, not specific examples per se.
>
> So far I am loving this 40 pin chip, it's making my life a lot easier for
> the radio control unit side. I plan on the 24 pin version in the sub
> itself as it has less hardware to deal with so I can get by with less I/O.
>
> Thanks for reading.
>
>
[noparse][[/noparse]Non-text portions of this message have been removed]