最近在用jy61,发些资料给大家分享。
因为我使用的是单片机接受,先放个51的使用例程:
注意波特率的问题
#include <reg52.h> 
#include <string.h>
#include <stdio.h>
unsigned char Re_buf[11],counter;
unsigned char ucStra[6],ucStrw[6],ucStrAngle[6];
void main(void)
{
	float Value[3];
	unsigned char i=0;
	TMOD=0x20; //波特率9600
	TH1=0xfd;
	TL1=0xfd;
	TR1=1;
	TI=1;
	REN=1; 
	SM0=0;
	SM1=1;
	EA=1; 
	ES=1;
	printf("51单片机读取串口\r\n");
	while(1)
	{
		 	Value[0] = ((short)(ucStra[1]<<8| ucStra[0]))/32768.0*16;
			Value[1] = ((short)(ucStra[3]<<8| ucStra[2]))/32768.0*16;
			Value[2] = ((short)(ucStra[5]<<8| ucStra[4]))/32768.0*16;
			printf("a:%.3f %.3f %.3f  ",Value[0],Value[1],Value[2]); 
			
		 	Value[0] = ((short)(ucStrw[1]<<8| ucStrw[0]))/32768.0*2000;
			Value[1] = ((short)(ucStrw[3]<<8| ucStrw[2]))/32768.0*2000;
			Value[2] = ((short)(ucStrw[5]<<8| ucStrw[4]))/32768.0*2000;
			printf("w:%.3f %.3f %.3f  ",Value[0],Value[1],Value[2]); 
		 	Value[0] = ((short)(ucStrAngle[1]<<8| ucStrAngle[0]))/32768.0*180;
			Value[1] = ((short)(ucStrAngle[3]<<8| ucStrAngle[2]))/32768.0*180;
			Value[2] = ((short)(ucStrAngle[5]<<8| ucStrAngle[4]))/32768.0*180;
			printf("A:%.2f %.2f %.2f\r\n",Value[0],Value[1],Value[2]); 
	}	
}
void ser() interrupt 4
{
	if (RI)
	{
		RI=0;
		Re_buf[counter]=SBUF;	
	
	    if(counter==0&&Re_buf[0]!=0x55) return;
	              
	    counter++; 
	    if(counter==11) 
	    {    
	       counter=0; 
			switch(Re_buf [1])
			{
			case 0x51:
			ucStra[0]=Re_buf[2];
			ucStra[1]=Re_buf[3];
			ucStra[2]=Re_buf[4];
			ucStra[3]=Re_buf[5];
			ucStra[4]=Re_buf[6];
			ucStra[5]=Re_buf[7];
			break;
			case 0x52:	 
			ucStrw[0]=Re_buf[2];
			ucStrw[1]=Re_buf[3];
			ucStrw[2]=Re_buf[4];
			ucStrw[3]=Re_buf[5];
			ucStrw[4]=Re_buf[6];
			ucStrw[5]=Re_buf[7];
			break;
			case 0x53: 
			ucStrAngle[0]=Re_buf[2];
			ucStrAngle[1]=Re_buf[3];
			ucStrAngle[2]=Re_buf[4];
			ucStrAngle[3]=Re_buf[5];
			ucStrAngle[4]=Re_buf[6];
			ucStrAngle[5]=Re_buf[7];	
			break;
			} 
	      }
	  }
    
}
输出a为加速度,w为角速度,A为角度
原文:https://www.cnblogs.com/blg2/p/11913828.html