Demo entry 6718724

c语言

   

Submitted by anonymous on Mar 06, 2018 at 03:54
Language: C. Code size: 728 Bytes.

void FeedToMaster()				//四组反馈数据一个组合,得到:输出、设定、输出、实际值的组合,一旦得到实际值,上位机记录组合后三组数据
{
	static unsigned char whichFeed=0,whoFeed=0;
	whichFeed=1-whichFeed;
	if(whichFeed==0)
	{
		paraInfo.id=100;                    //发回比例输出,
		memcpy((((signed int *)&paraInfo)+1),ratioOut,14);	//因强制转换为int型数据,所以&paraInfo+1跳转到了第三个字节地址
		memcpy(com0SendBuf,&paraInfo,sizeof(PARAINFO));
			
	}		
	else
	{
		whoFeed=1-whoFeed;
		if(whoFeed==0)
		{
			sPos.id=1;
			memcpy(sPos.scmdPos,sPosCmd,12);//只有前6个有位置设定值
			memcpy(com0SendBuf,&sPos,sizeof(SPOS));//sPos.id=1; 发送从手位置设定指令,滤波后的位置
		}
		else
		{
			memcpy(com0SendBuf,&sFeed,sizeof(SFEED));//sFeed.id=0; 发送从手状态 包含各种故障诊断指令,从手位置状态
		}
	}
	writeSerial1(com0SendBuf,sizeof(SPOS));
}

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).