Using a 18F26J11 device and having problems loading a byte or word into the program memory space. Program details below:
#CONFIG
CONFIG WDTEN = ON
CONFIG STVREN = ON
CONFIG XINST = OFF
CONFIG DEBUG = OFF
CONFIG CP0 = OFF
CONFIG OSC = INTOSC ; For 8MHz clock set CONFIG OSC = INTOSC. For 32MHz clock set to INTOSCPLL.
CONFIG T1DIG = ON
CONFIG LPT1OSC = ON
CONFIG FCMEN = OFF
CONFIG IESO = OFF
CONFIG WDTPS = 512 ; 2.1 sec.
CONFIG DSWDTOSC = INTOSCREF
CONFIG RTCOSC = INTOSCREF
CONFIG DSBOREN = OFF
CONFIG DSWDTEN = OFF
CONFIG DSWDTPS = 2048 ; 2.1 sec.
CONFIG IOL1WAY = OFF
CONFIG MSSP7B_EN = MSK5
CONFIG WPEND = PAGE_WPFP
CONFIG WPCFG = OFF
CONFIG WPDIS = OFF
DEFINE OSC 8
DEFINE USE_LFSR 1
DEFINE HSER_CLROERR 1
DEFINE HSER2_CLROERR 1
DEFINE WRITE_INT 1
a VAR BYTE
ERASECODE $F400
WRITECODE $F400, $55
READCODE $F400, a
The value of "a" always comes back as $FF. I have tested the READCODE at other locations in memory and it works. I first erase block 62. One block equals 1024 bytes then follow with the WRITECODE command. Program code protection is turned off as shown in the configuration setting. Does anything stand out here ?
- Martin
Bookmarks