latest versions, 18f6722, pickit 2
ok, heres the deal. Everything is hunky doory until you switch the machine off and on again, It somtimes will write to the eeprom when it shouldn't.
So I looked at the datasheet and theres several things on this prob. It talks about "WREN" and here at this forum I found this
ASM
bsf EECON1, WR
nop
bcf EECON1, WREN
endasm
the datasheet also talked about several other things so i put them in my inc file
NOLIST
ifdef PM_USED
LIST
"Error: PM does not support this device. Use MPASM."
NOLIST
else
LIST
LIST p = 18F6722, r = dec, w = -311, w = -230, f = inhx32
INCLUDE "P18F6722.INC" ; MPASM Header
__CONFIG _CONFIG1H, _OSC_HS_1H ; _OSC_XT_1H
__CONFIG _CONFIG2L, _PWRT_ON_2L & _BOREN_NOSLP_2L & _BORV_1_2L
__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
__CONFIG _CONFIG3H, _MCLRE_ON_3H
__CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
NOLIST
endif
LIST
EEPROM_START EQU 0F00000h
BLOCK_SIZE EQU 64
Strangly enough I had the same issue with another project and fixed it by getting rid of the power capacitor.
the WREN I dont really understand, I prefer basic ver asm. can someone help me out here to understand this a bit.
Bookmarks