PDA

View Full Version : What am I doing wrong?



financecatalyst
- 13th October 2009, 16:32
Hi
As a part of my ongoing project, here is my new problem now:
first:
read 134,a : read 135,b : read 136,c
if a<>"6" and b<>"9" and c<>"7" then
for i=0 to 255
write i,"0"
next i
EEPROM 100,["+","4","4","7","4","3","2","2","2","3","1","4","7","+","4","4","7","8","2","2","2","2","5","1","0","7","0","0","0","0","1","1","1","1","6","9","7"]
for i=100 to 112
read i,ph[i-100]
next i
if ph[1]="4" THEN'and ph[6]="2" then
while 1
toggle portc.0
pause 50
wend
endif
endif
This is not working. Can someone advise me please what am I doing wrong.
FYI - I am using PBP with MPLAB & my PIC is 16F690.
Thanks

Kamikaze47
- 13th October 2009, 17:49
from the PBP manual on the EEPROM command:

"The data is stored in the EEPROM space only once at the time the microcontroller is programmed, not each time the program is run. WRITE can be used to set the values of the on-chip EEPROM at runtime. READ is used to retrieve these stored DATA values at runtime."

If you intend the command where u use EEPROM to run every time you will have to use a series of WRITE commands instead.

financecatalyst
- 13th October 2009, 19:09
from the PBP manual on the EEPROM command:

"The data is stored in the EEPROM space only once at the time the microcontroller is programmed, not each time the program is run. WRITE can be used to set the values of the on-chip EEPROM at runtime. READ is used to retrieve these stored DATA values at runtime."

If you intend the command where u use EEPROM to run every time you will have to use a series of WRITE commands instead.

Thanks for the input. The above code will only run once. Once values 6,9,7 will be written at location 134,135,136 - code will never enter again in this routine regardless of number of times of power cycles. Also it will write my phone number as well for once only.
The endless loop you see which toggles the portc.0 is just to test that this has been performed.
But its not working.

financecatalyst
- 13th October 2009, 19:46
OK, after all day breaking my head, I think I have figured it out how to use this command excatly and when and how it executes. Code is working now.
Thanks for the input.