I'm trying to figure it out this block of code from SDFS how to make disable hardware SPI.
Code:
' Initialize some values for the following subroutines
SDC_UseHardSPI = TRUE ' Use hardware SSP port for SPI.
DISK_mount = FALSE ' The card has not been initialized.
FAT_mode = "r" ' Read mode if not otherwise specified.
FAT_count = 0 ' Default character count to 0.
' Skip over SD/MMC/FAT subroutines
Goto SkipSD
' Subroutines for communicating with an SD/MMC card
' Subroutine to initialize SD card pins
InitIO:
SD_CS = 1 ' SD card not selected.
SD_CS_TRIS = 0 ' Output SD card chip select.
SD_CD_TRIS = 1 ' Input card detect.
SDO = 1 ' Start SPI data out high.
SDO_TRIS = 0 ' Output SPI data out.
SDI_TRIS = 1 ' Input SPI data in.
SCL = 1 ' SPI clock idles high.
SCL_TRIS = 0 ' Output SPI clock.
Return
' Subroutine to initialize hardware SSP for SPI at less than 400kHz
OpenSPIM:
If (SDC_UseHardSPI) Then
SSPSTAT = %00000000 ' Sample at middle of data output time, Mode 1, 1: Transmit on idle to active clock transition.
SSPCON1 = %00010010 ' SPI master mode, clock = Fosc/64, Mode 1, 1: Clock idle high.
SSPEN = 1 ' Enable hardware SPI port.
Endif
Return
' Subroutine to initialize hardware SSP for SPI at full speed
OpenSPIMFast:
If (SDC_UseHardSPI) Then
SSPSTAT = %00000000 ' Sample at middle of data output time, Mode 1, 1: Transmit on idle to active clock transition.
SSPCON1 = %00010000 ' SPI master mode, clock = Fosc/64, Mode 1, 1: Clock idle high.
SSPEN = 1 ' Enable hardware SPI port.
Endif
Return
' Subroutine to release hardware SSP from SPI
CloseSPIM:
If (SDC_UseHardSPI) Then
SSPEN = 0 ' Disable hardware SPI port.
Endif
Return
But not really sure what to do? Hope anyone can help out...
/tacbanon
Bookmarks