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?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using 0.95.
In the HELP pages under SPIMode it says:
Syntax:
SPIMode Mode [ 0 | 1 ]
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?
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.
Adapted Help page. See here
Thanks!