I am using a atmel AT45DB161D serial eeprom and need to do a continious memory read.
I am programming a pic 18f4620.
This is the code the format of the 21 bits I need to send.
I would need to send this as 3 bytes but don't know how to do this correctly.
Code:
/ /<---------Page Addr--------------->/<------starting byte----->/
/X,X,X,20,19,18,17,16/15,14,13,12,11,10,09,08/07,06,05,04,03,02,01,00/
The XXX are don't care bits.
In another compiler I can do this by using a Dword (32 bits) variable and the split the 32 bits into 4 bytes. Using only the last 3 bytes. This is accomplished using a pascal compiler using following code example.
Code:
procedure mm_rd_cmd(start:dword);
begin
BusyWait;
CS_Low;
SPI1_Write($E8);
SPI1_Write(higher(start));
SPI1_Write(hi(start));
SPI1_Write(lo(start));
SPI1_Write($00);
SPI1_Write($00);
SPI1_Write($00);
SPI1_Write($00);
end;
The higher, hi, and lo break the 24 bits of var "start" (a 32 bit Dword) into 3 lower bytes. Discarding the highest byte (bits 25 - 32).
Is there a way to get Picbasic Pro to do a similar thing. Help is greatly appreciated.
Thanks,
Bryan
Bookmarks