PDA

View Full Version : loop write eeprom



savnik
- 13th August 2006, 13:17
I have this code and i wonder if the eeprom is write continues or only if i push any button;

LOOP:

Button UP,1,10,2,b1,1,MONTE 'supervise the button UP
Button DOWN,1,10,2,b2,1,DESCEND 'supervise the button DOWN
Button CH_PAS,1,255,0,b3,1, CHOIX 'supervise the button PAS
PAUSE 100 'pause of 0.1s
I2CREAD SDA,SCL,ADDR2,[LOCK] 'check if pll is lock
WRITE 0, TMP_LO 'Store the 8 bits of weak weight of TMP in the EEPROM with address 0
WRITE 1, TMP_HI 'Store the 8 bits of strong weight of TMP in the EEPROM with address 1
GoTo LOOP

Darrel Taylor
- 13th August 2006, 21:23
Yup, it writes to the EEPROM on every loop.

With the PAUSE 100 in there, it will take only 2 hours and 45 minutes to completely use up the available 100,000 write endurance limit of a 16F877 or equiv.

Hope you haven't left it powered up :eek:

DT

savnik
- 13th August 2006, 23:29
I change the code and i believe now it's OK.

MAIN:

bla ... bla ...
bla ... bla ...
bla ... bla ...

LOOP:

Button UP,1,10,2,b1,1,MONTE
Button DOWN,1,10,2,b2,1,DESCEND
Button CH_PAS,1,255,0,b3,1, CHOIX
PAUSE 100
I2CREAD SDA,SCL,ADDR2,[LOCK]
GoSub AFFICHAGE
GoTo LOOP

MONTE: '** INCREASE THE FREQUENCY OF 1 PAS (STEP)

TMP = TMP + PAS
If TMP > 410 Then TMP = 0
GOSUB MEM
GoTo MAIN

DESCEND: '** DECREASE THE FREQUENCY OF 1 PAS (STEP)

If TMP<PAS Then RAZ_TMP
If TMP = 0 Then TOP
TMP = TMP - PAS
GOSUB MEM
GoTo MAIN

TOP:

TMP=410
GOSUB MEM
GoTo MAIN

RAZ_TMP:

TMP = 0
GOSUB MEM
GoTo MAIN

MEM:

WRITE 0, TMP_LO
WRITE 1, TMP_HI
Return

savnik
- 17th August 2006, 21:51
it's ok now;

savnik
- 20th August 2006, 08:58
any help ;

mister_e
- 20th August 2006, 09:06
it's ok now;
Where is the 'question mark' ?
What do you expect?
What is the real question?

savnik
- 20th August 2006, 09:18
I change the code and i believe now it's OK.

MAIN:

bla ... bla ...
bla ... bla ...
bla ... bla ...

LOOP:

Button UP,1,10,2,b1,1,MONTE
Button DOWN,1,10,2,b2,1,DESCEND
Button CH_PAS,1,255,0,b3,1, CHOIX
PAUSE 100
I2CREAD SDA,SCL,ADDR2,[LOCK]
GoSub AFFICHAGE
GoTo LOOP

MONTE: '** INCREASE THE FREQUENCY OF 1 PAS (STEP)

TMP = TMP + PAS
If TMP > 410 Then TMP = 0
GOSUB MEM
GoTo MAIN

DESCEND: '** DECREASE THE FREQUENCY OF 1 PAS (STEP)

If TMP<PAS Then RAZ_TMP
If TMP = 0 Then TOP
TMP = TMP - PAS
GOSUB MEM
GoTo MAIN

TOP:

TMP=410
GOSUB MEM
GoTo MAIN

RAZ_TMP:

TMP = 0
GOSUB MEM
GoTo MAIN

MEM:

WRITE 0, TMP_LO
WRITE 1, TMP_HI
Return
is the code now OK;

Acetronics2
- 20th August 2006, 09:20
Hi, Steve ...

may be the problem is here :

If TMP If TMP = 0 Then TOP

That works only vith very aged PIC's ...

Alain

mister_e
- 20th August 2006, 09:25
Alain, yeah i saw that one too... copy/paste mistake i guess.


That works only vith very aged PIC's
Vith? :)


is the code now OK;
;) i still searching the question mark but YES it looks OK.

any problem with your keyboard :)
?????????????????????????????????

savnik
- 20th August 2006, 09:28
Alain, yeah i saw that one too... copy/paste mistake i guess.


;) i still searching the question mark but YES it looks OK.

any problem with your keyboard :)
?????????????????????????????????
Yes is copy/paste mistake
The question was :
I have this code and i wonder if the eeprom is write continues or only if i push any button;
I make some changes above , but i don't know if the eeprom is write continues still
The code work very well

mister_e
- 20th August 2006, 09:31
As i said.. it looks good to me now @4:30 AM, after night-clubbing, dee-jay'ing, dancing and drinking and everything i can't say on a public forum finishing by 'ing'

What you can do for your own persual... Blink a led every time you write to your EEPROM.

High LED
WRITE . . .
Pause x
LOW LED

savnik
- 20th August 2006, 09:40
As i said.. it looks good to me now @4:30 AM, after night-clubbing, dee-jay'ing, dancing and drinking and everything i can't say on a public forum finishing by 'ing'

What you can do for your own persual... Blink a led every time you write to your EEPROM.

High LED
WRITE . . .
Pause x
LOW LED
I feel envy
How write the code in my programm , to blink the led every time the programm write to eeprom;

mister_e
- 20th August 2006, 09:42
i thought it was clear enough.. ok let's try once again.
MEM:
HIGH LED
WRITE 0, TMP_LO
WRITE 1, TMP_HI
pause 250
LOW LED
Return

savnik
- 20th August 2006, 09:47
i thought it was clear enough.. ok let's try once again.
MEM:
HIGH LED
WRITE 0, TMP_LO
WRITE 1, TMP_HI
pause 250
LOW LED
Return
THANK YOU VERY MUCH
Maybe i am blunt