Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[PIC] How to stored frequency to eprom

Status
Not open for further replies.

jaredsweesy

Newbie level 1
Joined
May 11, 2016
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
8
Hi There,
I am a newbie, could anyone help me to solved my problem, here are :
Code:
if(PORTA.F0 == 0) {
delay_ms(180);
if(++up>350)up=250;
frek(up);
}

if(PORTA.F1 == 0) {
delay_ms(180);
if(--dw<250)dw=350;
frek(dw);

//How to stored frequency after PORTA.FI or PORTA.F0 pressed


That mean once pressed the button on PORTA.F1 then will stored to latest frequency pressed.

Thanks.
Jared.
 

Not clear what exactly you want to do, but this code will not work as you expect.
The use of Delay() functions during reading of one button will lock the reading of another button in the meantime.
 

Also be careful of making frequent updates to a value in EPROM ( which I assume is actually an EEPROM). Normally EEPROMs have a fairly limited number of erase/write cycles (typically in the 100,000's) and if you are trying to write to the EEPROM after each button press then this could be exhausted in a fairly short period of time after which you will start to get errors.
A better idea is to keep the frequency (which I assume you are increasing by pressing a button on RA0 and decreasing by pressing RA1) in RAM and then store it to EEPROM either just before the device is turned off or some period after the last change.
Why not use the same variable that you are increasing and decreasing? This code looks a bit sloppy to me but we are really just guessing at what you are really trying to do.
I assume that you are using the delay as a key debounce technique.
Susan
 

Also be careful of making frequent updates to a value in EPROM ( which I assume is actually an EEPROM). Normally EEPROMs have a fairly limited number of erase/write cycles (typically in the 100,000's) and if you are trying to write to the EEPROM after each button press then this could be exhausted in a fairly short period of time after which you will start to get errors.

Or it completely dies...Back in the early days of the technology <10,000 cycles were typical and when your firmware/software engineer decides they need to have a power on test of everything on the board (including the eeprom)...read, erase , write 5A5A, read, erase, write A5A5, read, erase, write pattern F0F0, read, erase, write 0F0F, read, erase, write address, read, erase, write original data.
Code:
FW: Hey, the eeprom doesn't work anymore
HW: What? it was working when I gave you the board.
FW: I don't know it just started getting errors when reading back.
HW: since when?
FW: a couple of hours ago and it's gotten worse.
HW: Hmmm, let me look at the board...
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top