Help with SPI SP12T!!!!!!


Closed Thread
Results 1 to 6 of 6
  1. #1
    rush-bh's Avatar
    rush-bh Guest

    Default Help with SPI SP12T!!!!!!

    Hi folks!

    I'm trying to communicate a PIC16F877 (VCC = 5V) and a SP12T (VCC = 5V) by SPI protocol and i juust doesn't works!

    Can anybody help me? I've looked bilions of times to page 6 of the datasheet and i think that i'm doing it right!

    My code is below: ( made in CCS compiler )

    main () {

    setup_spi(SPI_MASTER|SPI_L_TO_H|SPI_CLK_DIV_64);
    (...)
    output_high(NCS);

    while(1) {

    while(input(wakeUP) == 0) {


    output_low(NCS); // envia o 3D
    spi_write(0x31);
    sok = spi_read(0); // Recebe 3D
    output_high(NCS);
    delay_ms(74);
    printf("\n\r SOK0: %x",sok);

    output_low(NCS);
    sok = spi_read(0); // Recebe 3D
    output_high(NCS);
    printf("\n\r SOK1: %x",sok);

    output_low(NCS);
    output_high(NCS); // Zera a linha de comando
    delay_ms(74);

    output_low(NCS);
    spi_write(0x31);
    output_high(NCS);
    delay_ms(74);


    output_low(NCS);
    sok = spi_read(0xFF);
    output_high(NCS);
    delay_ms(74);
    printf("\n\r SOK2: %x",sok);
    }
    }


    As u can see, I've tried in many diferent ways read the code 0x31 back!!!
    I've also tried to get the ID codes of the sensor, but i got only crap!

    Keyworks: SensoNor Infineon SP12T pressure TPMS sensor SPI microcontroler PIC CCS PicBasic

  2. #2
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    rush-bh

    This is a PICBASIC Forum, not a CCS Forum !
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  3. #3
    rush-bh's Avatar
    rush-bh Guest


    Did you find this post helpful? Yes | No

    Default

    Ralph,

    I know it is an PICBASIC forum... I don't care wich compiler use, i just want do communicate a PIC and a IC! In my opinion, foruns about Microcontrolers are just about it, make things works! The compiler is just a language to make it work!

  4. #4
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    rush-bh

    This is a PICBASIC Forum, not a MicroController Forum.

    If you don't care about a compiler, why don't you use PICBASIC?

    Please see also: This
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



  5. #5
    rush-bh's Avatar
    rush-bh Guest


    Did you find this post helpful? Yes | No

    Default

    Worked fine RALPH, thanks 4 your help! hehehehe

    I used transistors to switch the 3.3v ( new voltage of SP12T ) and the 5V ( PIC ). The transistors were to slow for 312,5MHz! The CLOCK lost the syncronism with SDO and SDI!

    A tip for the guys who have problems with 3.3v <-> 5v :
    MAXIM MAX3392E

    Good luck for you guys, and sorry for the PIC and CCS problems in a PICBASIC forum.

  6. #6
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by rush-bh
    Worked fine RALPH, thanks 4 your help! ...
    You're welcome
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



Similar Threads

  1. Using SPI with External Interrupts
    By shaiqbashir in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 29th June 2008, 04:08
  2. 16-bit SPI problem
    By shaiqbashir in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th June 2008, 15:42
  3. SPI Interfacing
    By toofastdave in forum Serial
    Replies: 8
    Last Post: - 18th November 2007, 11:15
  4. SPI configuration PIC versus Atmel
    By Pedro Santos in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th July 2007, 19:17
  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