This demo shows how to use the ADC (Analog to Digital) converter on SBC66 Netcruzer boards. The SBC66 Netcruzer boards have 12 Analog input ports, port 0-5 and 30-35 (old port names X0-X5, and Y0-Y5). For details see modtronix.com/product/sbc66ec/ For this demo, ports 2 and 5 (X2 and X5) are configured as Analog Inputs. By default the ADC is configured for voltages between 0 - 2.5V (To configure it for 3.3V inputs, see nz_analog.h file). This demo turns pins 38 and 39 (Y8 and Y9) on or off depending on the ADC values read on 2 and 5 (X2 and X5) pins. This demo is configured to create compact code, by adding the following 3 lines to the projdefs.h file:
This removes lots of code from the nz_analog module. Only indexed functions accessing ADC's 10-bit value can now be used. No channel (adcReadChan for example) or millivolt functions (adcReadChanMv for example) are available.
The following line is also added to the projdefs.h file, and dramatically reduces the RAM used by the nz_analog module. It indicates that we only use 2 ADC inputs, and space for all possible ones (12) does not have to be reserved.
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/adc/adc_compact" 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
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):