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

📄 t_write.c

📁 dsp6713开发板的许多例程.对入门特别有用
💻 C
字号:
/*************************************************************************
* FILENAME: $RCSfile: t_write.c,v $
* VERSION : $Revision: 1.2 $
* DATE    : $Date: 2000/11/03 19:17:23 $
* Copyright (c) 1997-2000 Texas Instruments Incorporated
*
* Target Write Example:
*____________________________________________________________________
* - Sends 100 integers, one at a time via RTDX_write().
* - Uses ONE output channel.
*
* - This is the module to be run on the TARGET.
* - This program is meant to be used with the RTDX Excel project's
*   VBA module h_read().
*************************************************************************/
#include <stdio.h>              /* fprintf(), puts()                    */
#include <stdlib.h>             /* abort()                              */
#include <rtdx.h>               /* RTDX                                 */
#include "target.h"             /* TARGET_INITIALIZE()                  */

/* Declare and initialize an output channel called "ochan"              */
RTDX_CreateOutputChannel(ochan);

#define NUMBER_MESSAGES 100

void main( void )
{
    unsigned int data;
    
    /* Target Specific Initialization                                   */
    TARGET_INITIALIZE();
    
    /* Enable the output channel, "ochan"                               */
    RTDX_enableOutput(&ochan);
    
    printf("Sending %d Messages to Host...", NUMBER_MESSAGES);
    for ( data = 0; data < NUMBER_MESSAGES; data++ ) {
        /* Send the data to the host                                    */
        if ( !RTDX_write( &ochan, &data, sizeof(data) ) ) {
            fprintf(stderr, "\nError: RTDX_write() failed!\n");
            abort();
        }
        
        /* Wait for Target-to-Host transfer to complete                 */
        while ( RTDX_writing != NULL ) {
#if RTDX_POLLING_IMPLEMENTATION
            /* If polling implementation of RTDX...                     */
            /* ...call RTDX_Poll to do data transfer                    */
            RTDX_Poll();
#endif
        }
    }
    
    /* Disable the output channel, "ochan"                              */
    RTDX_disableOutput(&ochan);
    
    puts("\nProgram Completed!"); 
}

⌨️ 快捷键说明

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