Faruk Chaudhry

HCS08QG8 - Bidirectional SPI routine

Discussion created by Faruk Chaudhry on Mar 14, 2007
Latest reply on Mar 14, 2007 by Brian Witzen
Hello,
CodeWarrior simulator does not work for this simple bidirectional SPI. Note, the device is a SPI compatible DAC (MAX548A) and only bytes are tranferred, no reads
The simulator does not set the second SPSTEF flag. The first SPSTEF is set almost immediately due to an idle SPI. Rather, the simulator sets SPRF when the second transfer starts, but its output mode.
void init_DAC(void)
{
unsigned char temp;

CS = LOW;
temp = SPIS;
SPID = 0xFF;
while(!SPIS_SPTEF);
temp = SPIS;
SPID = 0x00;
while(!SPIS_SPTEF);
while(SCLK);
CS = HIGH;
}
Note, CPOL and CPHA are 0 according to the MAX548A datasheet.


Alban Edit: FSL Part Number in Subject line.

Message Edited by Alban on 2007-03-14 11:33 AM

Outcomes