-
write -read problem?
Hi.
I am using Pic 16F628A for my project.And I am using PBP 2.5.
when I want to write and than read second item to eeprom second item is not writing on epprom memory and ı can not read it .
Code is as below:
....
..
..
A var word
B var Word
AB var word
CD var word
------------------
..
..
..
----------------
AB=A+B
Write 0,AB.Byte 0
Write 1,AB.Byte 1
..
..
---------------------
..
..
CD =B-A
Write 0,CB.Byte 0
Write 1,CB.Byte 1
----------------------
..
Read 0,AB.Byte 0
Read 1,AB.Byte 1
Read 0,CB.Byte 0
Read 1,CB.Byte 1
LCDOUT ,"adrste"#AB,"rtrefrt",#CB
-------
Question is;
When I use write and read code for only AB item no problem code (entire code not sample) works fine.
But when I use Write and Read for AB and CB items .AB items value is good but CB value is alltime 0 (zero) .it means CB value not writing and reading by code on eeprom.
How can I solve this problem .?Is there anybody to help me THanks.
-
hi
you have CD declared as a word variable and also :
CD =B-A
did you mean CB and not CD ?
-
sory
Hi.
Sory for miss writing it must be CD Not CB .
Thanks.
------
CD =B-A
Write 0,CD.Byte 0
Write 1,CD.Byte 1
----------------------
..
Read 0,AB.Byte 0
Read 1,AB.Byte 1
Read 0,CD.Byte 0
Read 1,CD.Byte 1
LCDOUT ,"adrste"#AB,"rtrefrt",#CD
-----------
Maybe this code mustbe as;??????
CD =B-A
Write 2,CB.Byte 0
Write 3,CB.Byte 1
----------------------
..
Read 0,AB.Byte 0
Read 1,AB.Byte 1
Read 2,CB.Byte 0
Read 3,CB.Byte 1
LCDOUT ,"adrste"#AB,"rtrefrt",#CB
-
Code:
Write 2,CB.Byte 0
Write 3,CB.Byte 1
That looks correct now. Is it working?
-
OK!
Yes now it is working .
Thanks