This demo shows how to use the system tick. The system tick uses Timer 1, and has a period of 1ms. Each 1ms an interrupt is triggered, and the 32-bit system tick is incremented. To make code smaller and more efficient, default tick functions use the lower 16 bits of the 32-bit system tick. This limits it to a maximum time of 32,768ms = 32.7 seconds. If this is not sufficient, the 32-bit tick functions can be used, which have a maximum time of 4,294,967,296 ms = 1,193 hours = 49.7 Days. The 16-bit variants are the most efficient, and create the smallest code, seeing that the native data size for this CPU is 16-bits.
This project can be run on any of our SBC66 Netcruzer boards. For prototyping, we recommend combining this board with a Prototyping Board, like the PT66ECI for example. This low cost prototyping board makes all the I/O ports of the SBC66 board available via marked labels on the PCB. It also provides a reset and firmware button that simplifies prototyping.
This project is located in the "src/demos/general/tick_demo1" folder of the Netcruzer Download. To compile for Netcruzer Board, open this project in MPLAB X, and select the "Project Configuration" for desired board. For example "SBC66ECL_R2" for the SBC66ECL Revision 2 board. For details click here.
A common error is "The system cannot find the path specified". This generally means you don't have the required XC16 compiler version installed. Go to "Project Properties", and select your installed XC16 compiler in the "Project Configuration" section.
After compiling (build), the board can be programmed via the USB Bootloader or a PIC Programmer. USB Programming is simplified when using the SBC board together with a Prototype Board.
2012-08-08, David H. (DH):