| ??? 11/30/04 05:19 Read: times |
#82212 - details Responding to: ???'s previous message |
I am using M95256 (ST make) EEPROM. My code is like this
#include <AT89S8252.H> void main() { void SPI_out(int send,int l_add,int u_add); void chip_command(int); int i; char a[50]; for(i = 0;i<50;i++) a[i] = i; EA = 1; ES = 1; SPCR = 0xD1; P1 &= 0xEF; chip_command(0x06);/* Write Enable for external EEPROM */ for(i=0;i<50;i++) { chip_command(0x02); SPI_out(a[i],0x00+i,0x02); } chip_command(0x04); SPCR = 0x04; } void SPI_out(int send,int l_add,int u_add) { DPH = u_add; DPL = l_add; SPDR = send; while(SPSR != 0x80); } void chip_command(int command) { SPDR = command; while(SPSR != 0x80); } |
| Topic | Author | Date |
| has anybody used SPI | 01/01/70 00:00 | |
| more details please | 01/01/70 00:00 | |
| details | 01/01/70 00:00 | |
| missing code? | 01/01/70 00:00 | |
| How to post code | 01/01/70 00:00 | |
| The story so far? | 01/01/70 00:00 | |
| no solution | 01/01/70 00:00 | |
| all is replied above | 01/01/70 00:00 | |
| So you want a solution? | 01/01/70 00:00 | |
| code and schematic | 01/01/70 00:00 | |
| unconnected reset? | 01/01/70 00:00 | |
| How about some clocking ?? | 01/01/70 00:00 | |
| Code still illegible! | 01/01/70 00:00 | |
| is it C-language? | 01/01/70 00:00 | |
| reply of queries | 01/01/70 00:00 | |
| complaining | 01/01/70 00:00 | |
| Do you want to be helped? | 01/01/70 00:00 | |
| Watch window in Keil | 01/01/70 00:00 | |
Registers window in Keil | 01/01/70 00:00 | |
| EA | 01/01/70 00:00 |



