Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

MPLAB's "View EEPROM"

Status
Not open for further replies.

futz

Active Member
Am I using MPLAB's View EEPROM command wrong? I have written code for 16F876 to write a byte to EEPROM. After running it I refresh the View EEPROM window and nothing has changed. Am I using the tool wrong?

Or is there something wrong with my code? I've written it the hard way as well as the easy way, using BoostC's EEPROM lib.

The (not so) hard way:
Code:
#include "eep.h"

void main(void)
{
	while(eecon1.WR){}		//wait for write to finish
	eeadr=5;			//set address to write to
	eedata=0x56;			//set data to write
	eecon1.EEPGD=0;			//clear EEPGD - point to EEPROM data memory
	eecon1.WREN=1;			//enable writes
	eecon2=0x55;
	eecon2=0xaa;
	eecon1.WR=1;
	eecon1.WREN=0;			//disable writes
	while(1){}
}

The easy way with the lib:
Code:
#include "eep.h"
#include <eeprom.h>

void main(void)
{
	eeprom_write(5,0x56);
	while(1){}
}

and the header file:
Code:
#include <system.h>
#include <stdio.h>
#pragma CLOCK_FREQ 18432000
#pragma DATA _CONFIG, _WDT_OFF & _HS_OSC & _LVP_OFF
 
Last edited:
How did you refresh the EEPROM window? Don't you have to read the device after programming and running, in order to see the byte you wrote?
 
Last edited:
How did you refresh the EEPROM window? Don't you have to read the device after programming, in order to see the EEPROM data?
Aaaarrrrggghhhh!!!! Yes, that was it. I've been writing to EEPROM all along. :D Just couldn't confirm it till now. :p

I had been right-clicking and hitting Refresh, which is obviously completely useless.

Thanks eng1
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top