Shop OBEX P1 Docs P2 Docs Learn Events
A little timing to do... — Parallax Forums

A little timing to do...

ArchiverArchiver Posts: 46,084
edited 2001-07-25 23:59 in General Discussion
Here's an easy one for a PIC in ASM, but I need it yesterday, so that's
out...
I have a variable time base output that I want to toggle over two pins, and
something keeps nagging at me, telling that it's not beyond the capabilities
of a Basic program.
I have 39 different sets of "packets" for lack of a better term. each
represents a proportional number of bits off and on. The shortest one is a
value based on two bits, the longest may be as many as 30 bits long. The
number of 1 bits vs. the 0 bits determines a value for use later on in the
process. These are proportional values. To make it interesting, each bit
needs to be of a fixed length, say 10msec, and they need to be distributed
over two pins in a manner that approximates even spaces of 0's between the
1's and vice-versa. The two pins need to output in alternating time, and I
have clocking inputs to time each one.
So the output may have one range that goes something like this:
pin1, 0; pin2, 1; pin 1, 1; pin 2, 0; pin1, 1, pin 2, 1. This would give me
4 bits high out of a base of 6.
I'm thinking of calling this and 38 others out of a lookup table from a
running control input. As the input changes, different output sets of
different lengths distributed over the two pins will be called. If the
control input doesn't change, the same set of outputs needs to be repeated
without gaps in time, until a new control value is input. When a new control
value is input, the called output has to transition in smoothly also.

Does anyone have an idea of how to set up the Basic table for this?

Thanks in advance,
Chris
Sign In or Register to comment.