piclist 1999\05\09\194443a >
Thread: Frequency Multiplier
face BY : Mark Willis email (remove spam text)

Erik, Roland's approach sounds probably easier for you to do then.
(Beware, girlfriend's interrupting me a lot today so I'd rather scream &
run, I think.  I may look a little more distracted than average,

 To build a real time operating system like this, the usual approach is
to do this (Time-Slicing Real Time OS idea;  Pseudo-Code warning <G>):

 goto Main_Loop;

 The main idea here is to split each task into little tiny "time slice"
pieces - i.e. the first time you call Do_Part_of_Task1(), for example,
it just does one small part of it's job - the next time through it does
the next part of it's job, and so on.  Something like:

Proc Do_Part_of_Task1()
 Static Int WhichSlice1=0;  /* Initialize only at startup, not with
each call to this procedure <G> */
 Const n = 3; /* number of total time slices for this task, arbitrarily
3 here. */

 WhichSlice1 = (WhichSlice1 + 1) mod n;
 Case WhichSlice of
    1:  Do_Task1_TinyPart1(); break;
    2:  Do_Task1_TinyPart2(); break;
    3:  Do_Task1_TinyPart3();

 Task1TinyPart1 could do the first half of a math calculation, part 2
could do the next half, part 3 could do a comparison to check & see if
it's time to flip an output bit - for something somewhat specific here.
Do feel free to use more than 3 slices, too!  (In avionics, for example,
you commonly test ALL CPU instructions, regularly, so TinyPart1 might
test a register increment instruction, TinyPart2 a register assign,
TinyPart3 a register decrement, TinyPart4 a Jump instruction, and so on
and on, probably 100 slices or more <G>

 Task 1 could be "check if it's time to flip the 43uSec pulser".  Task
2 could be some other pulser.  Task 3 could be "see if the paper roll's
turned another turn", and could gradually increase or decrease the Paper
Roll Diameter variable, to suit the radius of the paper roll.  The
problem can be figuring out how to do things just right, the first time

 You can also do this in two ways, "Isochronously" or "Synchronously";
The first means you have routines that take different numbers clock
cycles to run through, so you need a synchronizing delay loop in
Do_ShortDelay() to sync everything up to the (Timer) heartbeat;  The
second would be needed if you're way low on CPU resources, you make sure
that whatever happens your program takes the exact same number of cpu
cycles to do it's job, then you don't have any delay loop;  Harder to
do, but if you need the cycles to all do processing not overhead, you
need it.

 There is no "Wrong" way to do something like this, so long as your
code works, it's "right".  Do it the way that makes sense to you!


erik wrote:
{Quote hidden}

> > {Original Message removed}
<37361DCE.74F00680@nwlink.com> 7bit

See also: www.piclist.com/techref/index.htm?key=frequency+multiplier
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) Frequency Multiplier

month overview.

new search...