|
Re: spi interface with accelerometer and pic 18f448 problem
There are so many weird quirks with SPI that it will be almost impossible to find a perfect solution on the Internet.
I suggest that you get four things to solve your problem: an oscilloscope (preferably a digital one, as you can "pause" these), the accelerometer datasheet (especially the SPI timing diagrams), the microcontroller datasheet, and patience.
Try sending a sample data packet over the SPI bus. Hook up the SEL, CLK, MISO and MOSI lines to the oscilloscope. Watch the data packet being sent on the scope, and see if it looks like the timing diagrams. It could be something as simple as the SEL line goes active a half CLK cycle after the MOSI line starts sending data, throwing everything off. Or it could be much more complicated.
Debugging is a critical engineering skill, and it's one that can only be learned through lots of experience.
|