| Posted: 04:54pm 14 Mar 2019 |
Copy link to clipboard |
 Print this post |
|
Thanks for the suggestions. I tried what you suggested but no success. I then modified my code to be similar to that on page 95 of the manual - still no success.:
OPTION Base 1
DIM ww%(4) PIN(17)=1 'preset pin17 before it is setup Setpin 17, DOUT SPI OPEN 500000,0,8 '500 kHz, Mode 0,8 bits PIN(17)=0 'chip select low SPI WRITE 7,2,0,5,8,7,6,5 'write 4 bytes, '2'is write instruction, ' 0005' is the memory location, 8,7,6,5 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 SPI READ 4,ww%() 'read 4 bytes starting at 0005. PIN(17)=1 SPI CLOSE
Print ww%(1) Print ww%(2) Print ww%(3) Print ww%(4)
The program when run gives 255 for each location. This suggests the EEPROM is not being written to. I checked with my scope that there were clk pulses from the uP - that was ok but I did not see any pulses on the SPI data in pin. I am stepping back from this for a couple of days and come back to it with a clear head. Thanks for your suggestions. |