0,0 → 1,66 |
#include "main.h" |
#int_RB |
void RB_isr(void) |
{ |
|
} |
|
#define LCD_ENABLE_PIN PIN_E0 |
#define LCD_RS_PIN PIN_E1 |
#define LCD_RW_PIN PIN_E2 |
#define LCD_DATA4 PIN_D4 |
#define LCD_DATA5 PIN_D5 |
#define LCD_DATA6 PIN_D6 |
#define LCD_DATA7 PIN_D7 |
|
#include <lcd.c> |
|
//#define USB_CON_SENSE_PIN PIN_B2 |
|
// Includes all USB code and interrupts, as well as the CDC API |
#include <usb_cdc.h> |
|
#rom int 0xf00000={1,2,3,4} |
|
void main() { |
int i, j, address, value; |
|
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
setup_adc(ADC_OFF); |
setup_psp(PSP_DISABLED); |
setup_spi(SPI_SS_DISABLED); |
setup_wdt(WDT_OFF); |
setup_timer_0(RTCC_INTERNAL); |
setup_timer_1(T1_DISABLED); |
setup_timer_2(T2_DISABLED,0,1); |
setup_timer_3(T3_DISABLED|T3_DIV_BY_1); |
setup_comparator(NC_NC_NC_NC); |
setup_vref(FALSE); |
// enable_interrupts(INT_RB); |
enable_interrupts(GLOBAL); |
|
usb_init(); |
lcd_init(); |
|
lcd_gotoxy(1,1); |
printf(lcd_putc, "\fReady...\n"); |
|
while(!usb_cdc_connected()); |
|
do { |
printf(usb_cdc_putc, "\r\n\nEEPROM:\r\n"); // Display contents of the first 64 |
for(i=0; i<=3; ++i) { // bytes of the data EEPROM in hex |
for(j=0; j<=15; ++j) { |
printf(usb_cdc_putc, "%2x ", read_eeprom( i*16+j ) ); |
} |
printf(usb_cdc_putc, "\n\r"); |
} |
printf(usb_cdc_putc, "\r\nLocation to change: "); |
address = gethex_usb(); |
printf(usb_cdc_putc, "\r\nNew value: "); |
value = gethex_usb(); |
|
write_eeprom( address, value ); |
|
} while (TRUE); |
} |