PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Aug 19, 2010 3:24 pm |
|
|
Try a very simple test program, such as the one shown below.
I ran it in MPLAB simulator with vs. 4.110 and I got this result:
Quote: |
Initial values: 55, aa
After writing: 12, 34
|
That's correct. Try it and see what you get. If it fails, then post your
compiler version.
Code: |
#include <18F8722.h>
#fuses INTRC_IO, NOWDT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
#rom int8 0xf00000={0x55, 0xAA}
//==========================
main()
{
int8 a;
int8 b;
a = read_eeprom(0);
b = read_eeprom(1);
printf("Initial values: %x, %x \n\r", a, b);
write_eeprom(0,0x12);
write_eeprom(1,0x34);
a = read_eeprom(0);
b = read_eeprom(1);
printf("After writing: %x, %x \n\r", a, b);
while(1);
} |
|
|