SPI interfacing with BS2...examples please
cwolff
Posts: 24
Any example code of how to interface the BS2 with an SPI device would be appreciated.· Thank you,
Christopher
Christopher
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
Thank you for your reply.· I'm trying to interface with a v2xe compass.· I threw together some code but didn't get much output..except "0"
' {$STAMP BS2p}
COMpin········· CON············ 11··············· 'bs input pin
COMpout········ CON············ 12
CLK············ CON············ 15··············· 'clock pin
CS············· CON············ 14··············· 'SS pin
degree········· VAR············ Word············ 'data coming from compass
Main:
LOW CS······································ 'activate the compass
SHIFTIN COMpin, CLK, MSBFIRST, [noparse][[/noparse]degree]··········· 'shift in the data
HIGH CS········································· 'deactivate the compass
DEBUG ? degree
PAUSE 1000
GOTO Main:
Any suggestions, as always, are always appreciated.
Regards,
Christopher
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
Thanks, i'll move this discussion over there.· Your help is greatly appreciated.