Examples like this:-
Code: Select all
BYTE GetShortRAMAddress(BYTE address)
{
BYTE toReturn;
CSn = 0;
SPIPut((address<<1)&0b01111110);
toReturn = SPIGet();
CSn = 1;
return toReturn;
}
Code: Select all
BYTE GetLongRAMAddress(WORD address)
{
BYTE toReturn;
CSn = 0;
SPIPut(((address>>3)&0b01111111)|0x80);
SPIPut(((address<<5)&0b11100000));
toReturn = SPIGet();
CSn = 1;
return toReturn;
}
These are my feeble attempts, do you think they're miles out?
Code: Select all
Function GetShortRAMAddress(pAddress As Byte) As Byte
CSn=0
SPI.WriteByte((pAddress<<1) And %01111110)
result = SPI.ReadByte()
CSn=1
End Function
Code: Select all
Function GetLongRAMAddress(pAddress as word) as Byte
CSn=0
spi.writebyte(((pAddress>>3) and %01111111)or $80)
spi.writebyte(((pAddress<<5) and %11100000))
result = spi.readbyte()
CSn=1
end function
These are my first dabblings in SPI.
I couldn't find any examples in the SF folder and I was really hoping for a Tutorial....