Shiftin with external Clock howto ?


Closed Thread
Results 1 to 4 of 4
  1. #1

    Default Shiftin with external Clock howto ?

    Hi

    I have a hardware situation where I need to read a 12bit serial output
    clocked by his own clock

    If i'm right all Shiftin commands generates an own clock signal
    is there a way to use an external clock with some sort of shiftin

    When the chipselect pin goes low, the clock is present and starts sending the 12bits
    once finished Chipselect goes high etc...

    Any help welcome

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default Re: Shiftin with external Clock howto ?

    As far as I know there is no PBP command to do it. You could, depending on the speed of your external device clock, roll your own or perhaps you could use a PIC with a SSP module capable of operating in slave mode.

    Since, if I understad correctly, YOU initiate the read by pulling the CS\ low (ie you know exactly when the data is starting to come in) it should be quite possible to roll your own routine if the speed is fairly low. It's nothing I've done personally though but off the top of my head something like:
    Code:
    InputData Var WORD
    InputPin VAR PortB.0
    ClockInput VAR PortB.1
    CSOutput VAR PortB.2
    i var BYTE
     
    InputData = 0          ' Initialize
    CSOutput = 0          ' Pull CS line low to initiate transfer
     
    For i = 1 to 12         ' Get 12 bits
    While ClockInput = 0    ' Wait for clock going high
    Wend
     
    InputData = InputData << 1 + InputPin
     
    While ClockInput = 1    ' Wait for clock going low
    Wend
     
    Next                        ' Do next bit until we have 12
     
    CSOutput = 1
    /Henrik.

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Shiftin with external Clock howto ?

    What device are you working with?
    Dave
    Always wear safety glasses while programming.

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: Shiftin with external Clock howto ?

    Well the device is a 16F877 which talks to a DAC7611, i have no access to the 16F877 software and would like to use the data (value) send to the DAC in another circuit
    So i want to read what the 16F877 is sending to the dac by a small MCU

Members who have read this thread : 1

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