Planning a project

In creating a project, many steps are taken. From realizing what it is you
want, to programming, to electronic considerations, and testing.
Select a type of PIC chip.
After checking out many PIC chips, I obtained a better knowledge of
what's available, and what I needed as a minimum. The price climbs
with some of the bigger chips, and so does its complexity. Although
there may be a need for 5 -8 bit ports (40 input/ouputs) is some applications,
for the most part I never needed any more than 2 1/2 ports. (20 I/O's)
In my opinion, the 16C55 and 16C57 are best for novices. Go to
Microchip
and view the data sheets for a while, then check out some of the bigger chips!
I'm sure you'll agree.
Of course I am a minimalist ( Old habit from the TTL days! )
There are also smaller PICs with A/D converters etc, but not enough ports
for driving displays and the like.
Too complex for one chip?
How much will the chip have to do? Is there a requirement for large
memory? How fast does it have to be? Are you experienced enough at
programming to handle any complex math routines or conversions that
may be required? These are questions that should be answered prior to
beginning the progect.
---Decide on the amount the chip must handle ie: inputs, outputs, driving
several pieces of hardware simultaneously, input readyness etc
---If the user (RAM
(1) ) memory requirements go beyond a few 10's of bytes,
an external DRAM
(2) or non-volatile EEPROM (3) may be required.
The program memory, on the other hand is quite large enough for most
applications. In the data sheets there is also info on interfacing EEPROMs.
---The speed is an important consideration when dealing with real world
situations. All hi-speed PICs can run at 20 megahertz, thus resulting in
a maximum instruction execution rate of 200 nanoseconds, or 5 Mc.
That's pretty fast, unless you're building an RF frequency counter!

*(1)RAM - Random Access Memory, looses data when power is removed
*
(2)DRAM - Dynamic Random Access Memory, same as memory used in a
computer. Needs constant refreshing or it will forget over a few ms.
*
(3)EEPROM - Electrically Erasable Programmable Read Only Memory
comes in conveniently small 8 pin serial I/O package. Keeps memory
even when power is removed. Slower to write than DRAMs.

 

Layout a flowchart
After you have decided what you want the project to do, you need some way
of creating a program architecture, and making it work with the inputs and
outputs of the chip. For example, in the afore-mentioned egg timer project,
a standby loop is required that will wait for the key-press from user to start
the countdown, or to set the time of the countdown. This would flow to an
"input time" routine, or a "start countdown" routine which would then either
jump back to wait for start countdown, or decrement the countdown register
then loop back until register is empty apon which time "bell" routine is called.

That's why a flowchart is necessary. Need I say more ;o)
Here is an example of a flow chart for the egg routine:

...............................................................................................


Note that this is not an actual programming flowchart, just a method to
follow while making up a programming flowchart. Each block would
contain a routine that either checks conditions of inputs, manipulates some
data, or outputs results. As you have probably noticed there are 4 loops.
The 4th is in the countdown to 0 block, which in itself could require a
flow chart. The point is to break up different steps of the program and
create a routine for that function only, that will be compatable with the
rest of the program..