Lab Nine Lab09 Instructions
User Manual:
Open the PDF directly: View PDF .
Page Count: 1
Page 1 of 1
Lab 9
Debouncing, EEPROM Data Memory, Flash EEPROM Program Memory,
and Indirect Addressing
This lab familiarizes the student with switch debouncing software, EEPROM data memory,
Flash EEPROM program memory modification during program execution, and indirect
addressing.
1. Create a new project with lab09.asm. Connect a push button to RB0. Connect eight LEDs to
the PORTC pins. Run the program. Every time you press the RB0 button the next PORTC
LED should turn on. However, the switch bounces, so sometimes when you press the RB0
button the LEDs “skip.”
2. Select the View
→
EEPROM menu item in MPLAB. You can double-click an EEPROM
byte to change the EEPROM data in the PIC. You can also right-click in the EEPROM
window, and then select the Fill Memory menu pop-up, to fill an entire block of EEPROM.
3. Select the Configure
→
Configuration Bits menu item in MPLAB.
a) The Flash Program Write Enable bit (the WRT bit in the configuration word) specifies
whether or not the EECON registers can be used to write to program memory. See page
120 in the data sheet for more information.
b) If Flash Program Write is enabled, the Code Protection bits (CP1:CP0) in the
configuration word specify which program memory addresses can be written with the
EECON registers.
c) Select the PICkit as the debugger tool in MPLAB. Then select the Debugger
→
Settings
menu item. Unselect the Preserve device EEPROM checkbox. This allows you to
program EEPROM at the same time that you program the PIC.