Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/15/02 13:24
Read: times


 
#32566 - RE: C source of SPI example


Michael Karas wrote:
-------------------------------
sean lee:



I don't have direct information regarding the SPI in C language. However the SPI interface to other devices is quite similar to the AD98XX chip. For example the 93C46 and similar serial EEPROM parts use almost the same kind of interface.



If you go to the Atmel web site there is a data sheet Interfacing 93CXXX Serial EEPROMs with AT89CX051 MCU you can see how similar the hardware interface is.



Atmel also has a self extraxting ZIP file AAT93CXX.EXE that has SPI routines written in assembly language. It should be very easy to translate this code to equivalent C routines



Good Luck

Mike Karas








Hi, All,
Would you please take a look at the code as follows, the MOSI is always high and SCK is one high(220sec/Div) clock only in logic analyzer. It is to mean that the initial process is not successful, or other else?
--------------------------------------------

void SPI_init(void)
{
SS = 1;
MOSI = 1;
MISO = 1;
SCK = 1;

SPCON = 0x57;
}

void enable_write(void)
{
SS = 0;
masterIO();
SS = 1;
}

void masterIO()
{
SPDAT = 0x55;
do {
SPSTA &= 0x80;
} while (SPSTA == 0x0);
}
void main(void)
{
SPI_init();
enable_write();
}



List of 4 messages in thread
TopicAuthorDate
C source of SPI example            01/01/70 00:00      
RE: C source of SPI example            01/01/70 00:00      
RE: C source of SPI example            01/01/70 00:00      
RE: C source of SPI example            01/01/70 00:00      

Back to Subject List