PIC16F1823, PIC Microcontroller, I2C, Digital Potentiometer
Channel: Nolan Manteufel
TIP: Right-click and select "Save link as.." to download video
Initializing link download.....
The digital potentiometer is on the I2C bus. When the digital pot is disconnected (unplugged) an I2C "No Acknowledgement" (NACK) occurs. When a NACK occurs i turn on the orange LED. When communication is reestablished, i turn the orange LED off.
When the I2C clock and data wires are shorted, it causes the microcontroller to do something unexpected. It never returns to the interrupts. I enabled the Watch Dog Timer and placed the CLRWDT command in the Interrupt Service Routine. When the hardware bug causes the PIC to hang up, the WDT triggers a RESET and the microcontroller "reboots" itself.
At first glance, I2C is confusing. Actually, a solid understanding of I2C takes many hours of study spread over several days. This was my first I2C project, i recommend it for microcontroller intermediates.
I use interrupts. This allows the microcontroller to execute many lines (thousands) of code while messages are being sent. The alternative is polling the interrupt flag.
A full description of this experiment, copy of the assembly code and schematic are available here: https://sites.google.com/site/porquenoengineering/
PIC Microcontroller, PIC16F1823
WatchDog Timer, Watch Dog Timer, WDT
Digital Potentiometer, MCP4018
MOSFET, 2N7000, 2N7002
Electrical and Computer Engineering,
University of Texas at San Antonio,