| Posted: 02:25pm 13 Mar 2019 |
Copy link to clipboard |
 Print this post |
|
Hi,
I am using a Maximite to communicate with a Microchip 25LC512 EEPROM.I need help with the read command. Writing a byte to it has 4 bytes in the command, first is the command, second & third the address and finally the data byte.
Writing the read command has 3 bytes; first byte is the command,next two bytes are the address. The byte at the address is immediately clocked back but I don't know how to capture the data.
This is my code.
PIN(17)=1 'preset pin17 before it is setup Setpin 17, DOUT SPI OPEN 4000000,0,8 '4MHz, Mode 0,8 bits PIN(17)=0 'chip select low SPI WRITE 4,2,0,5,8 'write 4 bytes, '2'is write instruction, ' 0005' is the memory location, 8 is data PIN(17)=1 'CS high 'try to read back Pause(100) PIN(17)=0 'CS low SPI Write 3,3,0,5 'Send the read command to the EEPROM ' Read 3 bytes,the next'3' is read cmd, 0005 is memory location byte1=SPI(0) 'Trying to get byte from memory PIN(17)=1 SPI CLOSE
?byte1
The data comes back as 0.
Any suggestions would be appreciated
Thanks |