ADIS16250: Help with setting up SPI


Closed Thread
Results 1 to 29 of 29

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Hello all, I finally got it working. I fixed it by changing the settings for the SHIFTOUT and SHIFTIN commands. Here is my source:

    <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
    DIN var portd.3 'data from PIC to Gyro
    DOUT var portd.4 'data from gyro to PIC

    temp1 var word
    index var word

    high RST

    pause 1000

    main:
    low CS
    Shiftout DOUT, SCLK, 5, [$04\8,$00\8]
    high cs
    pause 10
    low CS
    SHIFTIN DIN, SCLK, 6, [temp1\16]
    high cs

    HSEROUT ["Temp1: 0x",dec temp1,13]
    pause 100
    goto main
    </code>

  2. #2
    Join Date
    Sep 2006
    Location
    Mexico
    Posts
    47


    Did you find this post helpful? Yes | No

    Talking

    Good job!!

  3. #3


    Did you find this post helpful? Yes | No

    Default

    I wrote up some new code that is meant to use two ADIS16250 Gyros. Once I figure out what LSB (Not Least signifigant bit)(I think), I will use them in a RC Helicopter Navigation system.
    <a href="http://initialdrivegtr.po.gs/SourceCode-2.htm">http://initialdrivegtr.po.gs/SourceCode-2.htm</a>

    I hope this helps anyone that has had any trouble with these gyros too. Thanks for all your help!

    InitialDriveGTR

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Look fine but there's 2 mistake in this
    Code:
         DEFINE HSER_CLOERR 1
    should be
    Code:
         DEFINE HSER_CLROERR 1
    __________________________________________________
    Code:
       INCLUDE "modedefs.bas"
    Nowhere in your code you're using MSBPRE, LSBPRE or else, you're using the SHIFTIN/SHIFTOUT mode # instead. You can remove this INCLUDE line.
    __________________________________________________

    Just for safety sake, you should set CS0, CS1 to high before the main loop. Just before the PAUSE 1000
    Last edited by mister_e; - 28th September 2006 at 04:16.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5


    Did you find this post helpful? Yes | No

    Default

    The Defines for the Hardware serial were generated using a program I found here. So, I honestly didn't even know what it was(or at least I didn't put much thought into them). As for the MSBPRE, etc. I found I fould change between using the numeric values and the text versions, so I just left it there.

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    DOH! so it was partially my fault. You used the old version of the SPBRG calc... wich is mine... i thought i sent the updated one seems not. BTW.. you're not using HSERIN so it doesn't cause any problem

    Anyways here's the corrected version

    EDIT: i remind to have posted an update... but on a USB thread. DOH!

    Anyways, there's another applet comming soons including Timer calc, Reverse timer calc, SPBRG and HPWM. Still on test as now.

    I don't want to do the same mistake twice
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  7. #7


    Did you find this post helpful? Yes | No

    Default

    Do you know what the "LSB" is on the ADIS16250 datasheet? I think it is being used as a unit. Thanks

    PS mister_e, I could host your calculator software on my website if you would like

Similar Threads

  1. Winbond ISD1700 Voice Recorder
    By RFEFX in forum mel PIC BASIC Pro
    Replies: 58
    Last Post: - 22nd April 2014, 10:00
  2. PICKit2 - warning about configuration words
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 26
    Last Post: - 4th August 2009, 14:01
  3. Using SPI with External Interrupts
    By shaiqbashir in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 29th June 2008, 04:08
  4. 16-bit SPI problem
    By shaiqbashir in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th June 2008, 15:42
  5. How to configure SPI in PICBASIC PRO?
    By moogle in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 15th April 2007, 18:31

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts