SPI communication problem (newbie)


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Feb 2008
    Posts
    2

    Smile

    Thank you very much for your answer falingtrea. I forgot to mention on the first post I'm using PicBasic Pro from microengineering labs with a PIC16F84 and a 10MHz crystal. I'm powering the PIC with 5 volts and the SPI sensor with 3.1 volts. It's still not clear to me if just by using the shiftin and shiftout commands I get the 2KHz that the datasheet specifies for the clock, or if there's a formula on how to calculate that depending on your crystal.

    Now, from your reply I believe I have the following:

    1) From what I understand the part clocks data in on the falling edge and out on rising edge.
    2) The part is unidirectional.
    3) I don't know I hope I can use the shiftin and shiftout commands.

    I would like to attach part of the datasheet for what we are discussing in case you have some spare time to look at it and are willing to help me in case I'm not explaining myself clear or I'm confusing things, but unfortunately I don't see the option for it.

    Kind regards.

  2. #2

    Default

    One thing you should do is preset the CLK and Data lines before calling Shiftout or Shiftin. Just set the clock to output and the correct idle state level, and Data to an input. Some parts could be picky about the starting state before you drop CS. Also, you didn't mention the clock idle state for the part you are using. That is very important also.

    I would also just define one data pin variable. Since it is unidirectional, you only have one data pin anyway. Less confusing that way.

    And is the output high level of the SPI device high enough for the PIC to accept as a high? The portB pins you are using are TTL and need at least 2V for a high.

  3. #3
    skimask's Avatar
    skimask Guest

    Default

    Quote Originally Posted by lm555cn View Post
    SPI sensor with 3.1 volts.
    SPI sensor... Kinda vague, dontcha think?
    What are you trying to communicate with?
    An SPI capable frog or what?

Similar Threads

  1. 16-bit SPI problem
    By shaiqbashir in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th June 2008, 15:42
  2. Replies: 3
    Last Post: - 22nd January 2008, 03:48
  3. SPI communication ??
    By CosMecc in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 3rd November 2006, 00:22
  4. Replies: 5
    Last Post: - 20th March 2006, 01:34
  5. Replies: 8
    Last Post: - 11th November 2004, 20:08

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