s1l3.c

来自「TI公司54XX系列DSP程序.很好实用的哦!」· C语言 代码 · 共 49 行

C
49
字号
/*********************************************************************
 * S1L3.c - (Section 1, Lesson 3) RECEIVING AN INTEGER FROM THE HOST
 *          This is the RTDX Target Code for Section 1, Lesson 3
 *
 * This example receives integer value 5 from the host
 ********************************************************************/
 
#include <rtdx.h>       /* defines RTDX target API calls            */
#include "target.h"     /* defines TARGET_INITIALIZE()              */
#include <stdio.h>      /* C_I/O                                    */

/*********************************************************************
 * Insert code from Step #2 here - to create a global input channel
 ********************************************************************/
RTDX_CreateInputChannel( ichan );

void main()
{
        int data;
        int status;

        TARGET_INITIALIZE();

        /*************************************************************
         * Insert code from Step #3 here - to enable the input
         *                                 channel
         ************************************************************/
        RTDX_enableInput( &ichan );
 
        /*************************************************************
         * Insert code from Step #4 here - to request an integer
         ************************************************************/
        status = RTDX_read( &ichan, &data, sizeof(data) );

        if ( status != sizeof(data) ) {
                printf( "ERROR: RTDX_read failed!\n" );
                exit( -1 );
        } else
                printf( "Value %d was received from the host\n", data );

        /*************************************************************
         * Insert code from Step #5 here - to disable the input
         *                                 channel
         ************************************************************/
        RTDX_disableInput( &ichan );

        printf( "Program Complete!\n" );
}

⌨️ 快捷键说明

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