Look in the "Assembler tricks" sticky thread at the top of this forum. Beau has posted and excellent set of examples including SPI/shiftin-out routines.
Keep in mind when looking at that thread, you may need to insert delays.· The code was tested with 74HC165 and 74HC595's but for some·devices
the Assembly SPI example might be too fast.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ Beau Schwabe
IC Layout Engineer
Parallax, Inc.
The HM55B compass does not need the speed of assembly language. SPIN is much easier to use than assembly, much easier to read, has basic operators that don't exist in assembly (like multiplication and division). The ability to structure programs around subroutine calls with parameters, local variables, objects, case and if statements, etc. makes constructing and debugging a program much easier.
Comments
Keep in mind when looking at that thread, you may need to insert delays.· The code was tested with 74HC165 and 74HC595's but for some·devices
the Assembly SPI example might be too fast.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.