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

📄 s2l5.c

📁 德州仪器公司的6000系列的程序示例,可以看看实现什么功能,如果需要可以继续上传,配套有电子版说明
💻 C
字号:
/*********************************************************************
 * S2L5.c - (Section 2, Lesson 5) WRITING AN ARRAY OF INTEGERS USING
 *                                SAFEARRAYS
 *          This is the RTDX Target Code for Section 2, Lesson 5
 ********************************************************************/
 
#include <rtdx.h>       /* defines RTDX target API calls            */
#include "target.h"     /* defines TARGET_INITIALIZE()              */
#include <stdio.h>      /* C_I/O                                    */

/* declare a global input channel                                   */
RTDX_CreateInputChannel( ichan );
 
void main()
{
        int arraydata[10];
        int status,i;

        TARGET_INITIALIZE();

        /* enable the input channel                                 */
        RTDX_enableInput( &ichan );

        /* receive an array of integers from the host               */
        status = RTDX_read( &ichan, arraydata, sizeof(arraydata) );
        if ( status != sizeof(arraydata) ) {
                printf( "ERROR: RTDX_read failed!\n" );
                exit( -1 );
        } else
                for( i = 0; i < (sizeof(arraydata) / sizeof(int) ); i++)
                        printf( "Value %d was received from the host\n",
                                arraydata[i] );

        /* disable the input channel                                */
        RTDX_disableInput(&ichan);

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

⌨️ 快捷键说明

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