Fair enough that does help. That being said I really do need a routine for those "baby" EEProms (2000 bytes is nothing to scoff at)
I have read through the AN690 written by micro chip but am having a problem interpalting that to PICBasic.
The example they give is written in a pseduo language:
EXAMPLE 1:
function TestIfSizeIs(Size N): boolean
( // is memory range 0..N-1 ?
var TEMP;
TEMP = Read( 0000);
if ( Read( N) == TEMP)
Write( 0000, TEMP+1)
if ( Read( N) == TEMP+1)
Write( 0,TEMP-1)
return( TRUE)
// else
return( FALSE)
) //end function
Having this function, we can then set up a loop to test
memory sizes.
In the case of the Standard I2C, we can loop and test
from N=128 to N=2048 corresponding to models from
24C01 up to 24C16 doubling N at each iteration as in
the following:
EXAMPLE 2:
function StandardI2CMemDetect() : integer
( // returns a model number 1..16
N = 128
MODEL = 1
loop
if (TestIfSizeIs( N))
break
else
N=N*2
MODEL=MODEL*2
while(N<=2048)
return ( MODEL);
) //end function
Similarly, a function to measure Smart Serial memories
will loop with N=4096 up to N=32768.
Thoughts?




Bookmarks