The data adresses is ok. However, the ADIS16250 SPI clock speed is 2.5 MHz, you need to decrease your clock speed in order to transfer data between devices.
Try reading the status register of the ADIS16250 ($3C).
The data adresses is ok. However, the ADIS16250 SPI clock speed is 2.5 MHz, you need to decrease your clock speed in order to transfer data between devices.
Try reading the status register of the ADIS16250 ($3C).
How does one go about decreasing the SPI clock speed?
Thanks,
Benjamin B. Roy
Hello. add this line to your code:
DEFINE SHIFT_PAUSEUS ms
ms is the time in milliseconds between clock pulses
What would be a good pause time? (Note that I am completely new to this)a
To obtain clock speed:
Freq [Hz] = 1/period[seconds]
Test it with 1 ms (about 1Khz).
If it doesnt work try with another SPI mode, remember MSB first.
This is my code:
<code>
DEFINE OSC 20
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 24h
DEFINE HSER_SPBRG 21 ' 57600 Bauds
DEFINE HSER_CLOERR 1
DEFINE SHIFT_PAUSEUS 1000
INCLUDE "modedefs.bas"
Hserout ["ACTIVE",13]
RST var portd.0
SCLK var portd.1
CS var portd.2
DOUT var portd.3 'data from PIC to Gyro
DIN var portd.4 'data from gyro to PIC
temp var word'(2)
index var word
High SCLK
High CS
high RST
pause 1000
main:
low CS
Shiftout DOUT, SCLK, 1, [$3C,$00]
high cs
pause 100
low CS
SHIFTIN DIN, SCLK, 2, [temp\16]
high CS
pause 100
HSEROUT ["Temp: ",HEX4 temp,13]
pause 100
goto main
</code>
And the output I am getting out is (HEX):
ACTIVE
Temp: 0000
Temp: 0900
Temp: 0900
Temp: 0900
Temp: 0900
Thanks
Is it correct? Does it work?
Take a look on Table 41 STATUS Bit descriptions (Datasheet pp. 30):
Address 0x3D, 0x3C
Default 0x0000
Default is valid only until the first register write cycle.
Try reading X-Axis data or another register.
Bookmarks