Try closing the memory and data windows in the CodeWarrior debugger when you run this code and see if it helps. I've seen issues before where the flag becomes cleared because the debugger memory window performs are periodic read of the register including the flag.
This is just a quick shot in the dark. If it does not work, please give an update.
More detailed:
"This is a side effect of the debugger.
Remember that the SPIF is cleared by a read of SPISR followed be a read of the data register. Since the SR register is memory mapped before the data register when the debugger read memory for display, this condition is met.
Turn off all memory windows and data windows and code should work as expected."
Message Edited by EMontanez on 03-13-2006 09:33 AM