Shiftin question


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Location
    Storrs, Ct.
    Posts
    91

    Default Shiftin question

    I'm controlling 3 MAX 6957 LED Drivers daisy chained together, Dout to Din. Most of the 6957's ports are for LED's however I'm using the middle chip's port 24 thru 27 for switch inputs and monitoring the 6957's port change Interrupt. (Thanks Darryl for the Instant Interrupts.)

    My question is how to receive the data sent from the 6957 when asked to send it. Here is the ISR.
    Code:
    Checkswitches:             
            disable
            Low CS
    ShiftOut IO, SCLK, MSBFIRST, [$D8, $00, $00, $00]   'send read command to chip 2 
            high CS
            Low CS
    ShiftOut IO, SCLK, MSBFIRST, [$D8, $00, $00, $00]   'push bits out SPI shoot(Datasheet page 10)
            high CS        
            low CS
    shiftin Datain, SCLK, LSBFIRST, [hold1, hold2, hold3, hold4]  'collect bits  
    'gosub setMbit
             enable
                      @ INT_RETURN
    The first shiftout loads the status bits into the shift register and the second shiftout pushes them out the Dout pin where I read them with the shiftin.
    I only need the Byte in Hold4 but need to collect 3 bytes of garbage to get to it.
    Is it ok to do it like this?
    Code:
    shiftin Datain, SCLK, LSBFIRST, [hold4, hold4, hold4, hold4]
    I know it works this way but is it the right way? Or should I be doing something completely different?

    Thanks for any replies. 16F876,PBP2.47,MCSP,MPASM,MCloader
    "It will never happen here!" just happened here.
    My thoughts and prayers for Sandy Hook victims and families.

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


    Did you find this post helpful? Yes | No

    Default

    As far as i know, there's no SKIP feature in SHIFTIN (as in HSERIN), so i think your method is the way to go.
    Steve

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

  3. #3
    Join Date
    Dec 2003
    Location
    Storrs, Ct.
    Posts
    91


    Did you find this post helpful? Yes | No

    Default If it works, Don't fix it.

    Thanks for the quick reply Steve.
    It does work fine just looks weird.
    "It will never happen here!" just happened here.
    My thoughts and prayers for Sandy Hook victims and families.

Similar Threads

  1. SHIFTIN problem
    By champion in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 29th January 2007, 03:31
  2. Question for a math guru
    By Christopher4187 in forum General
    Replies: 3
    Last Post: - 22nd November 2006, 09:45
  3. Please answer my first question
    By John_001 in forum Off Topic
    Replies: 1
    Last Post: - 15th September 2006, 06:49
  4. Using SHIFTIN
    By TonyA in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 31st May 2006, 15:38
  5. PIC18F458 Shiftin / Out
    By pberhin in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th May 2006, 20:36

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