camerart
Well-Known Member
Hi J,Something like this.
What makes ready bit go high?
See image
dredy:
Testrdy
SPISend 0x82
SPIReceive drdy
If drdy.0 = 0 then ' Test drdy bit
goto Testrdy
Endif
For i = 0 To 5
compss = 0 'CHIP SELECT COMPASS ON
addr = 0x83 + i
SPISend addr
SPIReceive data
b(i) = data
compss = 1 'CHIP SELECT COMPASS OFF
Next i
Return
Result of your CODE:
dredy: 'Test DRDY REG
testrdy:
SPISend 0x82
SPIReceive drdy
If drdy.0 = 0 Then
Goto testrdy
Endif
For i = 0 To 5
compss = 0 'CHIP SELECT COMPASS ON
addr = 0x83 + i
SPISend addr
SPIReceive data
b(i) = data
compss = 1 'CHIP SELECT COMPASS OFF
Next i
Return
......................................................................................
[00][00]Ready!
SELF TEST 255 255 2 1 192 254
AT+C002
-223.00,247.00,-323.00
-224.00,250.00,-318.00
-225.00,249.00,-319.00
-227.00,253.00,-327.00
-230.00,252.00,-318.00
-226.00,244.00,-318.00
-231.00,253.00,-317.00
-233.00,255.00,-327.00
-232.00,244.00,-316.00
-229.00,255.00,-323.00
-222.00,252.00,-324.00
-225.00,247.00,-321.00
-222.00,244.00,-326.00
-231.00,255.00,-321.00
==============================================================
I can see that this is not correct, but does the idea work, if corrected?
dredy: 'Test DRDY REG
For i = 0 To 5
compss = 0 'CHIP SELECT COMPASS ON
addr = 0x82 + i 'STI HXL-HZH'<<<<<<<<<<<<<<<<<<<<<<<<<<<
SPISend addr
SPIReceive data
b(i) = data
compss = 1 'CHIP SELECT COMPASS OFF
If st_1_raw.0 = 0 Then Goto dredy '<<<<<<<<<<<<<<<<<<
Next i
Return
_____________________________________________________________________