t_write.c

来自「TMS320F2812的C++ examples 各个模块的程序」· C语言 代码 · 共 56 行

C
56
字号
/********************************************************************* * FILENAME: $RCSfile: t_write.c,v $ * VERSION : $Revision: 1.17 $ * DATE    : $Date: 2000/11/03 19:12:26 $ * 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);void main( void ){        unsigned int i;        /* Target initialization for RTDX                           */        TARGET_INITIALIZE();        /* Enable the output channel, "ochan"                       */	        RTDX_enableOutput(&ochan);        for ( i = 0; i < 100; i++ ) {                /* Send the data to the host                        */                if ( !RTDX_write( &ochan, &i, sizeof(i) ) ) {                        fprintf(stderr,                                "\nError: RTDX_write() failed!\n");                        abort();                }                /* Wait for data transfer                           */                while ( RTDX_writing != NULL ) {                        #if RTDX_POLLING_IMPLEMENTATION                                /* Call 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 + =
减小字号Ctrl + -
显示快捷键?