Well like janni say, he's is not a mBasic user then probably that janni's don't have one code segment in mB but he's know well about. So Isohailimdad wrote: please post your code including circuit which help others to understand, that the delay is not necessary between write and read cycles. .
waiting for your new idea
regards
sohail
wrote some functions that not need delay to work with ME's EEPROM lib for Read has two choose one..
This is a small example, these functions can be improved as needed. The idea is to write/read any value up to 32bit's or any other data type.
Code: Select all
sub function Read_E2P_8To32Bit(dim Start_Addr as byte, dim const DataType as byte) as longWord
dim Count as byte
Count = 0
result = 0
while WR_EECON1_bit wend
FSR1PTR = @Result
POSTINC1 = Eeprom_Read(Start_Addr)
inc(Count)
while (Count < DataType)
POSTINC1 = Eeprom_Read(Start_Addr+Count)
inc(Count)
wend
end sub
sub procedure Write_E2P_8To32bit(dim Start_addr as byte,dim const Datatype as byte, dim DataPtr as ^byte)
dim Count as byte
FSR1PTR = DataPtr
Count = 0
while (Count < DataType)
EEPROM_Write(Start_addr+Count, POSTINC1)
inc(Count)
wend
end sub
sub function Read_E2PROM_8_32bit(dim Start_addr as byte, dim const DataType as byte) as longword
dim Count as byte
while WR_EECON1_bit wend
Count = 0
result = Eeprom_Read(Start_Addr+Count)
inc(Count)
while (Count < DataType)
result = (result << 8) or Eeprom_Read(Start_Addr+Count)
inc(Count)
wend
end sub
"Start_addr"+Offset, for any eeprom address up to 256Bytes.
"DataType"
1-> 08 data bit's (Byte)
2-> 16 data bit's(integer,word)
3-> 24 data bit's(any value between this range, but return will be ever 4Bytes)
4-> 32 data bit's(longword, longint, float)
"DataPtr" = the pointer that holds it's value data. Can be a byte, word, longint,longword, float or any given array from 0 up to 255.
note:
when working with values, depending of the data type the return value will need to be cast to it's type.
I hope that helps.
Regards;