Difference between revisions of "Index of sample code pages"

From OpenCircuits
Jump to navigation Jump to search
Line 1: Line 1:
 +
These are short sections of code for particular tasks.  The first goal is to get code that works.  Later goals include:
 +
 +
*Easily modified code..
 +
*Robust: failure resistant even with bad input.
 +
*Fast
 +
*Plays well when imbeded with other routines.
 +
*Minimum resource use.
 +
 +
Because of the different goals we may have more than one sample in each category.
 +
 +
 
== [[The perfect second]] ==
 
== [[The perfect second]] ==
  
Timing routines, showing how seconds can be counted
+
Timing routines, showing how seconds can be counted.  Want high accuracy even with odd clock rates.
  
 
== Output to A Shift Register ==
 
== Output to A Shift Register ==
 +
 +
Often used for port expansion.
  
 
== Software Circular Buffer ==
 
== Software Circular Buffer ==

Revision as of 17:50, 16 March 2009

These are short sections of code for particular tasks. The first goal is to get code that works. Later goals include:

  • Easily modified code..
  • Robust: failure resistant even with bad input.
  • Fast
  • Plays well when imbeded with other routines.
  • Minimum resource use.

Because of the different goals we may have more than one sample in each category.


The perfect second

Timing routines, showing how seconds can be counted. Want high accuracy even with odd clock rates.

Output to A Shift Register

Often used for port expansion.

Software Circular Buffer

A place to store and retrieve data, say bytes. First in First out. Methods to add and remove data.

read before write

Solving the issue of PIC16's pin state not being saved internally

Good Main Program Header

A C Program Header Example A good header is a help to anyone who wants to use your code.