📄 s2l4.c
字号:
/*********************************************************************
* S2L4.c - (Section 2, Lesson 4) WRITING AN INTEGER TO THE TARGET
* This is the RTDX Target Code for Section 2, Lesson 4
********************************************************************/
#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 data;
int status;
TARGET_INITIALIZE();
/* enable the input channel */
RTDX_enableInput( &ichan );
/* receive an integer from the host */
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 );
/* disable the input channel */
RTDX_disableInput( &ichan );
printf( "Program Complete!\n" );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -