| ??? 01/04/06 17:49 Read: times |
#106484 - "use code architect" and then drop half Responding to: ???'s previous message |
I used code architect
SPCTL = 0xD7;// configure SPI ESPI = 1; // enable SPI interrupt // send a byte Chip_S = 1; // slave select SPDAT = 0x09; // Send byte command delay(); SPDAT = 0x80; // send address byte delay(); Chip_S = 0; // end trans to CodeArchitect:
/***********************************************************************
DESC: Writes a byte to the SPI bus. spi_init must be called first
RETURNS: Nothing
************************************************************************/
void spi_write
(
unsigned char dat // byte to write
)
{
// wait for previous transfer to complete
while (mspibusy);
// SPI now busy
mspibusy = 1;
// write data to SPI bus
SPDAT = dat;
} // spi_write
/***********************************************************************
DESC: Initializes the SPI peripheral
SPI Clock frequency = 93.75 kHz
Set EA to 1 after calling
RETURNS: Nothing
************************************************************************/
void spi_init
(
void
)
{
// set MOSI, MISO, /SS and SPICLK as quasi-bidirectional
P2M1 &= 0xC3;
P2M2 &= 0xC3;
....Why did you "use code architect" and then drop half of the code followed by When I execute the code I do not see any response on the SPI pins.
Erik |



