main.c
来自「塞扑拉思 psoc spi模块 作为master 的应用程序.」· C语言 代码 · 共 31 行
C
31 行
//----------------------------------------------------------------------------
// C main line
//----------------------------------------------------------------------------
#include <m8c.h> // part specific constants and macros
#include "PSoCAPI.h" // PSoC API definitions for all User Modules
CHAR Message[] = "Hello";
CHAR *pbStrPtr = Message;
void main()
{
//Turn on SPI master
SPIM_Start(SPIM_SPIM_MODE_0 | SPIM_SPIM_MSB_FIRST);
/* Ensure the transmit buffer is free */
while(1)
{
while( ! (SPIM_bReadStatus() & SPIM_SPIM_TX_BUFFER_EMPTY ) );
SPIM_SendTxData( 48 ); //load the next byte
while( ! (SPIM_bReadStatus() & SPIM_SPIM_TX_BUFFER_EMPTY ) );
SPIM_SendTxData( 49 ); //load the next byte
while( ! (SPIM_bReadStatus() & SPIM_SPIM_TX_BUFFER_EMPTY ) );
SPIM_SendTxData( 50 ); //load the next byte
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?