This demo shows how to use the nz_debounce.h and nz_debounce.c files for debouncing noisy digital inputs. For this demo, port 32 and 33 (old port names Y2 and Y3) are used. These SBC66 Ports are connected to buttons on the DB66DEV1 development daughter board. These 2 buttons will rotate LEDs 1 to 4 left or right. LEDs 1 to 4 are located on IO Ports (ports of SBC) 6, 7, 8 and 9 (old port names X6, X7, X8 and X9) of the DB66DEV1. The following lines in the projdefs.h file specifies what ports are debounced:
Additionally the System LED blinks every second.
The project requires a SBC66 Netcruzer board, AND a DB66DEV1 development board. The DB66DEV1 is plugged into the daughter board connector of the SBC66 board. The DB66DEV1 module is however not required, and discrete buttons and LEDs can be connected to the SBC port pins via 1k resistors to 0V.
This project is located in the "src/demos/io/port_debounce" 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.
2013-05-03, David H. (DH):