pic basic ile seri eeprom'a blok veri yazma

Başlatan senol_sr, 31 Temmuz 2004, 19:35:59

senol_sr

arkadaslar 24c64 e 2 kbyte lik veri yi cok hizli bir sekilde yazdirmak istiyorum. fakat nasil olacagini bilmiyorum. verileri byte byte yazdirirken 10 ms beklemek gerekiyor. yani saniyede en fazla 100 byte veri yazabiliyorum. verileri blok olarak nasil yazabiliriz. bilgisi olan varmi ? . pic basic te tabiki. saygilar....

yıldırım ak

Page Write özelliğini kullanarak 32 byte ı bir seferde yazdırabilirsin. Stop bitini 32 byte tan sonra yollayacaksın. 32 byte tan sonra yine 10 ms bekleyeceksin.
"... Bana kulluk et; Beni anmak için namaz kıl" (Taha 14)

senol_sr

picbasic te bunu nasil yapabiliriz. bir ornek verebilirmisin ?

fsan

merhaba senol_sr,

asagida picbasic pro ile 64 byte lik bir array degiskenin bir i2c external eeproma (24LC256) tek bir komutla nasil yazilip okundugunu anlatmis bu bayan..

ayrica Pic lerin internal eeprom larina yazarken bekleme (pause 10ms) kullanmak gerekmiyor.. (gerekli bekleme süresini "Write" komutu hallediyor)

Alıntı yapılan: "Melanie"Nope, you still missed that cigar... but you're close...

StorePage var word
StartAddress var Word

StoreData:
StartAddress=StorePage*64
I2CWRITE SDA,SCL,EE_addr,StartAddress,[str data1\64]
Return

Consider the above subroutine. Before it is called, you set the Page Number that you wish to store your 64 bytes of data into. Since you wish only to store 3 pages, the variable StorePage can be 0, 1 or 2, but in fact for the 24LC256 can be any number between 0 and 511 (max 512 pages as you said).

The first line takes the Page number and converts it to a linear address pointer, so that for example, if your Page is zero, the address will point to zero. Page=1 then Address=64. Page=2 then Address=128 and so on...

The I2CWRITE line will save 64 bytes in one hit from your array data1 (providing your EE_addr is set correctly).

That's it... all there is to it.

To read back, just preset your StorePage accordingly and create a similar ReadData subroutine using I2CREAD...
Alıntı yapılan: "Melanie"Assuming you have 64 bytes of data in your array Data1. You now go save that data using...

StorePage=17:Gosub StoreData

Your data will be saved into the EEPROM with the first byte starting at address 1088 (Decimal) and the last byte at address 1151 (Decimal).

Just preset the StorePage you want to write to before calling the subroutine. StorePage will not automatically change or preset for you.

To read back that data into your array, simply...

StorePage=17:Gosub ReadData

where the ReadData subroutine is something like...

ReadData:
StartAddress=StorePage*64
I2CREAD SDA,SCL,EE_addr,StartAddress,[str data1\64]
Return

As you can see this is pretty much identical to the write routine.
Kolay Gelsin