⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hardwareprofile.h

📁 Embedded SD card Interface
💻 H
字号:
#include "p24FJ128GA106.h"




#define GetSystemClock()		(32000000ul)      // Hz
#define GetInstructionClock()	(GetSystemClock()/2)
#define GetPeripheralClock()	GetInstructionClock()
	
#define USE_SD_INTERFACE_WITH_SPI       // SD-SPI.c and .h

#define REDLED			LATEbits.LATE2
#define REDLED_TRIS		TRISEbits.TRISE2
#define GREENLED 		LATEbits.LATE4
#define GREENLED_TRIS	TRISEbits.TRISE4

// ENC28J60 I/O pins
#define ENC_RST_TRIS        (TRISCbits.TRISC14) // Not connected by default
#define ENC_RST_IO          (PORTCbits.RC14)
#define ENC_CS_TRIS         (TRISCbits.TRISC13)
#define ENC_CS_IO           (PORTCbits.RC13)

// SPI SCK, SDI, SDO pins are automatically controlled by the 
// PIC24/dsPIC/PIC32 SPI module 
#define ENC_SPI_IF			(IFS0bits.SPI1IF)
#define ENC_SSPBUF			(SPI1BUF)
#define ENC_SPISTAT			(SPI1STAT)
#define ENC_SPISTATbits		(SPI1STATbits)
#define ENC_SPICON1			(SPI1CON1)
#define ENC_SPICON1bits		(SPI1CON1bits)
#define ENC_SPICON2			(SPI1CON2)

// Peripheral Pin Select Outputs
#define NULL_IO		0
#define C1OUT_IO	1
#define C2OUT_IO	2
#define U1TX_IO		3
#define U1RTS_IO	4
#define U2TX_IO		5
#define U2RTS_IO	6
#define SDO1_IO		7
#define SCK1OUT_IO	8
#define SS1OUT_IO	9
#define SDO2_IO		10
#define SCK2OUT_IO	11
#define SS2OUT_IO	12
#define OC1_IO		18
#define OC2_IO		19
#define OC3_IO		20
#define OC4_IO		21
#define OC5_IO		22

#define SD_CS		_LATE7
#define SD_CS_TRIS	TRISEbits.TRISE7	

#define SD_CD		0

#ifdef USE_SD_INTERFACE_WITH_SPI
    
		#define SPICON1				SPI2CON1
        #define SPISTAT				SPI2STAT
        #define SPIBUF				SPI2BUF
        #define SPISTAT_RBF			SPI2STATbits.SPIRBF
        #define SPICON1bits			SPI2CON1bits
        #define SPISTATbits			SPI2STATbits
        #define SPIENABLE           SPI2STATbits.SPIEN

	
        #define SPICLOCK			TRISGbits.TRISG6
        #define SPIIN				TRISGbits.TRISG7
        #define SPIOUT				TRISGbits.TRISG8

		#if (GetSystemClock() < 100000)
            #error Clock speed must exceed 100 kHz
        #endif    

#endif
// Macros for input and output TRIS bits
#define INPUT_PIN   1
#define OUTPUT_PIN  0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -