Menu

hwspi.h question

Help
MBB
2016-01-27
2016-01-31
  • MBB

    MBB - 2016-01-27

    I'm using 0.95.

    In the HELP pages under SPIMode it says:

    Syntax:
    SPIMode Mode [ 0 | 1 ]

    Command Availability:
    Available on PIC microcontrollers with Synchronous Serial Port (SSP) module.
    The parameter is **either 0 or 1**.  Where the parameter sets the **clock polarity**.
    

    In hwspi.h under the Sub SPIMode (In SPICurrentMode, In SPIClockMode) section (around Line 164)
    Set SSPSTAT.CKE Off
    If SPIClockMode.0 = Off Then
    Set SSPSTAT.CKE On
    End If
    Set SSPCON1.CKP Off
    If SPIClockMode.1 = On Then
    Set SSPCON1.CKP On
    End If

    To cover the 4 possible configurations, shouldn't the help file say it can be 0, 1, 2, or 3?

    Also, doesn't this parameter set both clock polarity and clock edge?

     
  • Anobium

    Anobium - 2016-01-31

    This look likes a long standing mistake in the documentation. I will correct.

    The SPIMode method lets you set the clock polarity and phase.

    For the different modes CPOL = 0 or 1, and CPHA = 0 or 1 you can use eother of these options

    Option | Command | Comment
    ---------- | ----------
    SPIMode | SPIMode Master [0,3] | Range of 0,1, 2 and 3
    SPIMode | SPI_CPOL_n + SPI_CPHA_n | SPI_CPOL_n + SPI_CPHA_n when 'n' is 0 or 1.

    I will update the Help File.

     
  • Anobium

    Anobium - 2016-01-31

    Adapted Help page. See here

     
  • MBB

    MBB - 2016-01-31

    Thanks!

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.