User manual

PICkit™ SERIAL ANALYZER USERS
GUIDE
© 2007 Microchip Technology Inc. DS51647A-page 107
Appendix B. 28-Pin Demo Board I
2
C™ Demonstration Firmware
B.1 INTRODUCTION
The 28-Pin Demo Board I
2
C™ demonstration firmware communicates with the
PICkit™ Serial Analyzer using the I
2
C serial protocol. The PICkit Serial Analyzer will be
the I
2
C Master and the 28-Pin Demo Board will be the I
2
C Slave device. The 28-Pin
Demo board is programmed to emulate an I
2
C Real-Time Clock (RTC) and Serial
EEPROM.
B.2 HIGHLIGHTS
This chapter discusses:
Hardware
•Firmware
•I
2
C Communications
Slave Devices
Functions
B.3 HARDWARE
The 28-Pin Demo Board (DM164120-3) is populated with and configured for:
PIC16F886 configured using the 8 MHz internal clock
32 kHz Tuning Fork Crystal connected to Timer1 Low-power Oscillator
Four LEDs (DS1 through DS4) connected to RB0 through RB3
Potentiometer (RP1) connected to RA0/AN0
Push button (SW1) connected to RE3/MCLR
For more information about the 28-Pin Demo Board hardware, see the 28-Pin Demo
Board User’s Guide (DS41301).
B.4 FIRMWARE
The demo program source code and *.hex file can be found on the PICkit Serial
CD-ROM at D:\28-pin Demo Board\Firmware\.
The firmware is structured as multiple ‘modules’ representing functional components.
Each module contains, at minimum, an “initialization” routine (MODULE_INIT) and a
“service” routine (MODULE_SVC). Each initialization routine is called from MAIN once
on Reset. Each Interrupt Service Routine is called sequentially and continuously from
the MAIN Idle loop. Interrupt Service Routine is provided for the I
2
C module only. All
other modules are serviced in turn from the MAIN ‘Idle loop’.