18F4431 asm how to read EEPROM (internal)

Enhanced mid-range devices. PIC12F1xxx and PIC16F1xxx

18F4431 asm how to read EEPROM (internal)

Postby Michael » Tue Jan 22, 2019 4:16 pm

Where do I have error or what should I declare/configure to read internal 18F4431 EEPROM?

eeprom_loop
movf EE_count, W; move EEPROM address to W

;next lines copied from Microchip 18F44321 data sheet
MOVWF EEADR ; Data Memory Address to read
BCF EECON1, EEPGD ; Point to DATA memory
BSF EECON1, RD ; EEPROM Read
MOVF EEDATA, W ; W = EEDATA

;my code continued
movwf EE00; move EEPROM data to my EE00 variable
call display_EEPROM; my working LCD display routine
incf EE_count; next EEPROM address to read
call 1second_delay
goto eeprom_loop

18F4431 runs @ 40MHz with 10 MHz crystal and 4x pll

Michael niepsycholog@gmail.com
Michael
 
Posts: 2
Joined: Tue Jan 22, 2019 3:34 pm
PIC experience: Experienced Hobbyist

Re: 18F4431 asm how to read EEPROM (internal)

Postby ric » Wed Jan 23, 2019 1:09 pm

Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 659
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products

Re: 18F4431 asm how to read EEPROM (internal)

Postby Michael » Wed Jan 23, 2019 1:26 pm

SOLVED
Microchip forgot to add one more line in EEPROM reading example in their 18F4431 data sheet.
That is setting one more bit:
BCF EECON1, CFGS ; Access EEPROM

finally it should be:
MOVWF EEADR ; Data Memory Address to read
BCF EECON1, EEPGD ; Point to DATA memory
BCF EECON1, CFGS ; Access EEPROM; this line should be inserted here
BSF EECON1, RD ; EEPROM Read
MOVF EEDATA, W ; W = EEDATA
Michael
 
Posts: 2
Joined: Tue Jan 22, 2019 3:34 pm
PIC experience: Experienced Hobbyist


Return to 14-Bit Core (enhanced)

Who is online

Users browsing this forum: No registered users and 10 guests

cron