After banging around for a while, I was able to get this to give me good data from the inclinometer:
Code:
CS_I VAR PORTD.0 ' chip select Inclinomteter
CS_D VAR PORTC.3 ' chip select D/A
SCK VAR PORTD.3 ' clock
SDI VAR PORTD.2 ' data IN , MISO
SDO VAR PORTD.1 ' data OUT, MOSI
IncIn var word
HIGH CS_I
HIGH CS_D
LOW SCK
HIGH CS_I
'I = %00001000 'send TeMP command
I = %00010000 'send RDAX
Main:
GOSUB iNCrDG
hserout ["IncRdg ",bin IncIn," ",DEC IncIn," ",10,13]
PAUSE 100
goto main
'**** Subs *********************************
;---- Sub to read the inclinometer ------------------
IncRdg:
LOW CS_I ' enable writes to Inclinometer
SHIFTOUT SDO,SCK,1,[I] 'sends command to READ
SHIFTIN SDI,SCK,0,[IncIn\11]
HIGH CS_I
RETURN
My LOGIC pod had a bit of a rough time trying to make sense of the unusual length of data and that threw me for a bit, but the HSEROUT showed that all was good. .
Hope that help someone.
Bo
Bookmarks