📄 新建 文本文档.txt
字号:
/*********************************************************************
* S1L1.c - (Section 1, Lesson 1) SENDING AN INTEGER TO THE HOST
* This is the RTDX Target Code for Section 1, Lesson 1
*
* This example sends integer value 5 to the host
********************************************************************/
/*********************************************************************
* Insert code from Step #2 here - to include the rtdx header file,
* which defines the RTDX target API
********************************************************************/
#include <std.h>
#include <rtdx.h>
#include"target.h" /* defines TARGET_INITIALIZE() */
#include <stdio.h> /* C_I/O */
#include <log.h>
#include "rtdxbioscfg.h"
/* This is the value we are going to send to the host */
int arraydata[];
const int number=32;
void main()
{
int status;
TARGET_INITIALIZE();
/*使能输入、输出通道*/
RTDX_enableInput(&ichan);
RTDX_enableOutput(&ochan);
/*从输入管道中读数据*/
status=RTDX_read(&ichan,&arraydata,sizeof(int));
if (status!=sizeof(int))
{
LOG_printf(&trace, "ERROR: RTDX_read failed!\n" );
exit( -1 );
}
/*向输出管道中写数据*/
status=RTDX_write(&ochan,&arraydata,sizeof(int));
if ( status == 0 ) {
LOG_printf(&trace,"ERROR: RTDX_write failed!\n" );
exit( -1 );
}
LOG_printf(&trace,"has been writed to the host");
while ( RTDX_writing != NULL )
{
#if RTDX_POLLING_IMPLEMENTATION
RTDX_Poll();
#endif
}
/*关闭输入和输出通道*/
RTDX_disableInput(&ichan);
RTDX_disableOutput(&ochan);
LOG_printf(&trace, "Program Complete!\n" );
exit(-1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -