piclist 2001\01\29\103031a >
Thread: Assembler 101 question...
face BY : Bourdon, Bruce email (remove spam text)

Mac, and others:

When I first became interested in the PIC16F87x I had read that the flash
program memory could be read and immedeatly thought of tables... weeks later
you asked this and I tried to find that statement, well I finally found it -
sorry for the delay (from DS30292B-page 44):

4.5 Reading the FLASH Program Memory
A program memory location may be read by writing two
bytes of the address to the EEADR and EEADRH reg-isters,
setting the EEPGD control bit (EECON1<7>)
and then setting control bit RD (EECON1<0>). Once
the read control bit is set, the microcontroller will use
the next two instruction cycles to read the data. The
data is available in the EEDATA and EEDATH registers
after the second NOP instruction. Therefore, it can be
read as two bytes in the following instructions. The
EEDATA and EEDATH registers will hold this value until
another read operation or until it is written to by the user
(during a write operation).

BCF STATUS, RP0 ; Bank 2
MOVWF EEADRH ; MSByte of Program Address to read
MOVWF EEADR ; LSByte of Program Address to read
BSF STATUS, RP0 ; Bank 3
BSF EECON1, EEPGD ; Point to PROGRAM memory Required
BSF EECON1, RD ; EEPROM Read Sequence
NOP ; memory is read in the next two cycles after BSF EECON1,RD
BCF STATUS, RP0 ; Bank 2
MOVF EEDATA, W ; W = LSByte of Program EEDATA
MOVF EEDATH, W ; W = MSByte of Program EEDATA

{Original Message removed}

See also: www.piclist.com/techref/microchip/devices.htm?key=pic
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) Assembler 101 question...

month overview.

new search...