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

📄 putsuart4.c

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


/* UART4 is defined in following devices */
#ifdef _UART_IRDA_V1_4

/*********************************************************************************************
Function Prototype  : void putsUART4(unsigned int *buffer)
 
Include             : uart.h
 
Description         : This function writes a string of data to be transmitted 
                      into the UART transmit buffer.
 
Arguments           : buffer - This is the pointer to the string of data to be transmitted.
 
Return Value        : None
 
Remarks             : This function writes the data to be transmitted into the transmit buffer
                      until NULL character is encountered. Once the transmit buffer is full, 
                      it waits until data gets transmitted and then writes the next data into 
                      the Transmit register.
************************************************************************************************/

void putsUART4(unsigned int *buffer)
{
    char * temp_ptr = (char *) buffer;

    /* transmit till NULL character is encountered */

    if(U4MODEbits.PDSEL == 3)        /* check if TX is 8bits or 9bits */
    {
        while(*buffer != '\0')
        {
            while(U4STAbits.UTXBF); /* wait if the buffer is full */
            U4TXREG = *buffer++;    /* transfer data word to TX reg */
        }
    }
    else
    {
        while(*temp_ptr != '\0')
        {
            while(U4STAbits.UTXBF);  /* wait if the buffer is full */
            U4TXREG = *temp_ptr++;   /* transfer data byte to TX reg */
        }
    }
}

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

⌨️ 快捷键说明

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