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

📄 wrtsa.c

📁 TI公司的RTDX实时数据交换技术下位机实验代码
💻 C
字号:
/*************************************************
File: wrtsa.c - write a array to host 
Author: rongjie 
Data: 2006.04.09
modification history:
*/

/*
DESCRIPTION:
write a array of 3000 dots to host by rtdx every 500ms
This is the module to be run on the TARGET,use one output channel
INCLUDE FILES: fooLib.h
*/

/* includes */
#include <stdio.h>              /* fprintf(), puts()  abort() */
#include <stdlib.h>
#include "wrtsa_bioscfg.h"  /* include RTDX.h                                 */
//#include "TmrDrv.h"

/* defines */
#define MAX_ELEMENTS 3000   /*the size of array to be tranferred everytime*/
#define _MYDEBUG 0

/* typedefs */

/* variables */
int message[MAX_ELEMENTS];
int tarSit = 0;

/* function declarations */

void main()
{

   /* Enable the output channel, "ochan"                               */
    RTDX_enableOutput(&ochan);
    
    printf("Sending 1 Messages to Host of size %d...\n", 
         MAX_ELEMENTS);

}

//a PRD thread called every 500ms to transfer a array of 3000 dots
void arrayWrite()
{
    unsigned int y = 0;	
    int s1, s2;
	LOG_printf(&LOG0,"%d",tarSit);
	/* Build the array                                              */
	for ( y = 0; y < MAX_ELEMENTS ; y++ ) {
		message[y] = 0;//rand()%50;
	}
	message[tarSit] = 10;
	message[tarSit] = 12;
    tarSit++;

#if _MYDEBUG	        
	TMR_GetTime(&start);  
#endif	          
	/* Send the data to the host                                    */
	s1 = RTDX_write( &ochan, message, sizeof(message) );
	s2 = RTDX_write( &ochan, message, sizeof(message) );
#if _MYDEBUG	        
	TMR_Delta(&start, &passed);
#endif	        
	/* Wait for Target-to-Host transfer to complete                 */
	while ( RTDX_writing != NULL ) {
	#if RTDX_POLLING_IMPLEMENTATION
	/* If polling implementation of RTDX...                     */
	/* ...call RTDX_Poll to do data transfer                    */
	RTDX_Poll();
	#endif
	}
	asm("	nop	");
#if _MYDEBUG
	TMR_Delta(&start, &passed1);
#endif

	    
}

/*id Timer_Init()
{
	TIMER_Handle hTimer0;
	hTimer0 = TIMER_open(TIMER_DEV0, TIMER_OPEN_RESET);
	TIMER_configArgs(hTimer0,
					0x00000200,
					//75000*1000,
					75000*500,
					0);
    TIMER_start(hTimer0);
    IRQ_clear(IRQ_EVT_TINT0);
    IRQ_enable(IRQ_EVT_TINT0);
}*/


⌨️ 快捷键说明

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