s1l2.c

来自「TMS320c6000系列dsp软件模拟器在集成开发环境CCS中应用实例」· C语言 代码 · 共 51 行

C
51
字号
/*********************************************************************

 * S1L2.c - (Section 1, Lesson 2) SENDING AN ARRAY OF INTEGERS TO

 *                                THE HOST

 *          This is the RTDX Target Code for Section 1, Lesson 2

 *

 * This example sends integer values 1-10 to the host

 ********************************************************************/

 

#include <rtdx.h>       /* defines RTDX target API calls            */

#include "target.h"     /* defines TARGET_INITIALIZE()              */

#include <stdio.h>      /* C_I/O                                    */



/* These are the values we are going to send to the host            */

#define VALUES_TO_SEND {1,2,3,4,5,6,7,8,9,10}



/* declare a global output channel                                  */

RTDX_CreateOutputChannel( ochan );

 

void main()

{

        int arraydata[] = VALUES_TO_SEND;

        int status;



        TARGET_INITIALIZE();



        /* enable the output channel                                */

        RTDX_enableOutput( &ochan );



        /*************************************************************

         * Insert code from Step #2 here - to send the data to

         *                                 the host

         ************************************************************/

        status = RTDX_write( &ochan, arraydata, sizeof(arraydata) );



        if ( status == 0 ) {

                puts( "ERROR: RTDX_write failed!\n" );

                exit( -1 );

        }



        while ( RTDX_writing != NULL ) {

#if RTDX_POLLING_IMPLEMENTATION

                RTDX_Poll();

#endif

        }



        /* disable the output channel                               */

        RTDX_disableOutput( &ochan );



        puts( "Program Complete!\n" );

}

⌨️ 快捷键说明

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