📄 main.c
字号:
#define IN_MAIN
#include "config.h"
#include "SSP.h"
#pragma import(__use_no_semihosting_swi) //don't delete this line
#define SSP_SPI 0 //SPI格式
#define SSP_SSI 1 //SSI格式
#define SSP_Mic 2 //Microwire格式
#define SSP_MODE 1 //主机模式
#define SSP_Fssp 1000000 //通信速率1M
#define SSP_INT_En 0 //中断禁止
/*********************************************************************************************************
** Function name: IRQ_Exception
** Descriptions: interrupt exceptional handler , change it as needed
** don't delete this function
********************************************************************************************************/
void IRQ_Exception(void)
{
}
/*********************************************************************************************************
** 函数名称:DelayNS()
** 函数功能:长软件延时
** 入口参数:dly 延时参数,值越大,延时越久
** 出口参数:无
********************************************************************************************************/
void DelayNS(uint32 dly)
{
uint32 i;
for(; dly>0; dly--)
for(i=0; i<50000; i++);
}
uint8 rcv_data;
/*********************************************************************************************************
** 函数名称:Main()
** 函数功能:观察不同的帧格式波形。
********************************************************************************************************/
void Main(void)
{
TargetInit(VPBDIV_DATA, PLLCFG_DATA, MAMTIM_DATA); // don't delete
while((PLLSTAT & (1 << 10)) == 0); // can delete
PINSEL0 = 0x00000000; //设置I/O连接GPIO
PINSEL1 = 0x00000000;
SSP_Init(SSP_SSI,SSP_MODE,SSP_Fssp,SSP_INT_En); //初始化SSP接口
while(1)
{
rcv_data = SSP_SendByte(0xF9); //发送数据
DelayNS(50);
}
}
/*********************************************************************************************************
** End Of File
********************************************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -