PicKit I2C Serial Demo Board Application
Overview
This application demonstrates interfacing with the Microchip PicKit Serial I2C Demo Board using NetBurner's I2C Wire library. The demo showcases communication with 5 different Microchip I2C peripherals connected to the board.
Supported I2C Peripherals
The application interfaces with the following I2C devices:
- 24LC0B EEPROM - 2Kbit (256 x 8) non-volatile memory
- MCP9800 Temperature Sensor - 12-bit resolution temperature measurement
- MCP23008 GPIO Port Expander - 8-bit I/O expander connected to LEDs
- TC1321 DAC - 10-bit Digital-to-Analog Converter (0-2.5V range)
- MCP3221 ADC - 12-bit Analog-to-Digital Converter
I2C Addressing
The application uses 7-bit I2C addressing as follows:
| Device | Datasheet Address | Application Address |
| 24LC0B EEPROM | 0xA0 | 0x50 |
| MCP9800 Temperature | 0x92 | 0x49 |
| MCP23008 GPIO | 0x40 | 0x20 |
| TC1321 DAC | 0x90 | 0x48 |
| MCP3221 ADC | 0x9A | 0x4D |
Note: The application right-shifts datasheet addresses by 1 to remove the R/W bit for NetBurner I2C compatibility.*
Features
Interactive Menu System
The application provides a serial console menu with the following options:
- 1 - Erase EEPROM (fills with 0xFF)
- 2 - Read EEPROM (displays all 256 bytes)
- 3 - Write incrementing sequence to EEPROM (0x00-0xFF)
- A - Read ADC value and display as voltage
- D - DAC Test (prompts for 10-bit value input)
- T - Read Temperature Sensor (Celsius and Fahrenheit)
Automatic LED Sequencing
The application continuously cycles through the 8 LEDs connected to the MCP23008 GPIO expander, creating a moving light pattern that updates every 0.5 seconds.
Technical Details
EEPROM Operations
- Supports page writes up to 8 bytes at a time
- Implements write completion polling
- Handles write cycles automatically for larger data blocks
- 256-byte total capacity
Temperature Sensor
- Configured for 12-bit resolution
- Reads temperature in 2's complement format
- Converts to both Celsius and Fahrenheit
- Displays raw register data for debugging
DAC Operations
- 10-bit resolution (0-1023 range)
- 2.5V reference voltage
- Interactive value input with range validation
- Voltage output calculation and display
ADC Operations
- 12-bit resolution
- 3.3V reference voltage
- Automatic voltage conversion and display
- Raw register data output
Hardware Requirements
- NetBurner development board with I2C capability
- Microchip PicKit Serial I2C Demo Board
- Serial console connection for menu interaction
Important Notes
RTC Conflict Warning
The application includes a warning about I2C address conflicts with real-time clock (RTC) devices commonly found on NetBurner development boards. The RTC at address 0x51/0xA2 conflicts with the PicKit EEPROM address range and will not be functional when the PicKit board is connected.
Error Handling
The application includes comprehensive I2C error handling with descriptive status codes:
wire_success - Operation completed successfully
wire_data_too_big - Data size exceeds buffer limits
wire_NACK_on_address - Device did not acknowledge address
wire_NACK_on_data - Device did not acknowledge data
wire_other_error - General I2C error
wire_timeout - Communication timeout
Building and Running
- Include the necessary NetBurner libraries and headers
- Compile with the NetBurner toolchain
- Flash to NetBurner device
- Connect serial console at appropriate baud rate
- Connect PicKit Serial I2C Demo Board to I2C bus
- Use menu options to interact with peripherals
Code Structure
The application is organized into functional modules:
- Main Menu System - User interface and command processing
- Device-Specific Functions - Individual handlers for each I2C peripheral
- Utility Functions - ASCII conversion, buffer display, error handling
- LED Animation - Background LED sequencing task