+ Post New Thread
Results 1 to 4 of 4
  1. #1
    Junior Member level 1
    Points: 900, Level: 6

    Join Date
    Sep 2010
    Posts
    18
    Helped
    0 / 0
    Points
    900
    Level
    6

    Trouble sending SPI message from PIC16f876a to slave SPI device

    Hi,
    I am having difficulty sendind a message from my 16F876a to SPI slave,

    I do not care what information Slave sends back,
    I am using PIC Assembler.
    I am using 8MHz XTAL
    I initialize my PIC like this:see attachment

    I am working off example from Microchip see attachment,
    When i scope my CLK line of PIC I can not see it clocking the SPI at all.
    So I believe i am missing something fundamental, or is PIC not able operate SPI at 8MHz atal, there is no indication of this in data sheet

    •   AltAdvertisment

        
       

  2. #2
    Full Member level 2
    Points: 1,744, Level: 9

    Join Date
    Feb 2010
    Location
    Pennsylvania, U.S.
    Posts
    131
    Helped
    21 / 21
    Points
    1,744
    Level
    9

    Re: Trouble sending SPI message from PIC16f876a to slave SPI device

    Setting ADCON1 does not turn off analog functions. You also need to set the appropriate bits of CMCON. See the datasheet for the value of bits CM2:CM0 of CMCON.



    •   AltAdvertisment

        
       

  3. #3
    Junior Member level 1
    Points: 900, Level: 6

    Join Date
    Sep 2010
    Posts
    18
    Helped
    0 / 0
    Points
    900
    Level
    6

    Re: Trouble sending SPI message from PIC16f876a to slave SPI device

    after chacking data sheet i believe default value for CMCON is ok



    •   AltAdvertisment

        
       

  4. #4
    Full Member level 2
    Points: 1,744, Level: 9

    Join Date
    Feb 2010
    Location
    Pennsylvania, U.S.
    Posts
    131
    Helped
    21 / 21
    Points
    1,744
    Level
    9

    Re: Trouble sending SPI message from PIC16f876a to slave SPI device

    You shouldn't rely on default values. Set CMCON to off.



--[[ ]]--