Apple II for intro to microprocessors

From: Mike Ford <mikeford_at_socal.rr.com>
Date: Thu Jul 19 01:16:21 2001

>> Number (3) seems like really bad form, making a circuit that depends on the
>> processor running at some specific rate. Much better to write code that is
>> "aware" of the processor speed and compensates for it.
>
>How do you propose measuring the CPU speed? You always need _some_ timing
>reference of a known frequency (for example, one way is to see how many
>simple loops you can run between mains frequency interrupts, but you then
>need to know the mains frequency). And it adds complexity to the system.
>
>For embedded controllers it's very common to write the code for a
>particular clock crystal frequency and be done with it. Particularly for
>things like bit-banged serial I/O. A number of my listings start with
>comments like 'PIC 16C84 processor clocked at 4MHz' or whatever.

That works for me, and the next line would define some constant with a
value that I interpret to be 4 MHz within my code. That way when a new chip
comes out that supports 6 or 8 mhz, and I need more processing power the
design is easily updated. All this could fall into the great grey area of
personal style, but very often when I work on a project some specific
direction seems much more "right" than others. Sometimes I can explain my
point of view, others times I just know it even if I don't have a clue
exactly why.
Received on Thu Jul 19 2001 - 01:16:21 BST

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:33:53 BST