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

📄 putsspi3.c

📁 Mplab C30编译器
💻 C
字号:
#if defined(__PIC24F__)
#include <p24Fxxxx.h>
#endif
#include "spi.h"

/******************************************************************************************
Function Prototype : void putsSPI3(unsigned int length,unsigned int *wrptr)
 
Include            : spi.h
 
Description        : This function writes the data to be transmitted into the
                     Transmit Buffer (SPIxBUF) register.
 
Arguments          : length - This is the number of data words/bytes to be transmitted.
                     wrptr - This is the pointer to the string of data to be transmitted
 
Return Value       : None
 
Remarks            : This function writes the specified length of data words/bytes to be
                     transmitted into the transmit buffer.Once the transmit buffer is full,
                     it waits until the data gets transmitted and then writes the next data
                     into the Transmit register.The control remains in this function if SPI
                     module is disabled while SPITBF bit is set.
********************************************************************************************/
#ifdef _SPI_V2_3

void putsSPI3(unsigned int length, unsigned int *wrptr)
{
    char *temp_ptr = (char *) wrptr;
    while (length)                   /* write byte/word until length is 0 */
    {
        if(SPI3CON1bits.MODE16)
            SPI3BUF = *wrptr++;      /* initiate SPI bus cycle by word write */
        else
            SPI3BUF = *temp_ptr++;   /* initiate SPI bus cycle by byte write */
        while(SPI3STATbits.SPITBF);  /* wait until 'SPITBF' bit is cleared */
        length--;                    /* decrement length */
    }
}

#else
#warning "Does not build on this target"
#endif

⌨️ 快捷键说明

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