ElecMaster JY-61 Series Скачать руководство пользователя страница 11

 

 

http://www.aliexpress.com/store/1836321

 

- 11 - 

 

  The data packet is used to indicate the module whether enter into the IIC mode, the module 

will release the IIC MPU6050 bus, and the user can access to the original data of the MPU6050 

chip by IIC. If you receive 0x55 0x50 at the beginning of the data packet, the module works in the 

IIC mode, when you want to switch to the serial mode, please send a command 0xFF 0xAA 0x61, 

or use the PC program to modify. 

5.3

 

Data analysis sample code(Language C)

 

double

 a[3],w[3],Angle[3],T; 

void

 DecodeIMUData(

unsigned

 

char

 chrTemp[]) 


 

switch

(chrTemp[1]) 

 

 

case

 0x51: 

 

 

a[0] = ((

short

)(chrTemp[3]<<8|chrTemp[2]))/32768.0*16; 

 

 

a[1] = ((

short

) (chrTemp[5]<<8|chrTemp[4]))/32768.0*16; 

 

 

a[2] = ((

short

) (chrTemp[7]<<8|chrTemp[6]))/32768.0*16; 

 

 

T = ((

short

) (chrTemp[9]<<8|chrTemp[8]))/340.0+36.25; 

 

 

break

 

case

 0x52: 

 

 

w[0] = ((

short

) (chrTemp[3]<<8|chrTemp[2]))/32768.0*2000; 

 

 

w[1] = ((

short

) (chrTemp[5]<<8|chrTemp[4]))/32768.0*2000; 

 

 

w[2] = ((

short

) (chrTemp[7]<<8|chrTemp[6]))/32768.0*2000; 

 

 

T = ((

short

) (chrTemp[9]<<8|chrTemp[8]))/340.0+36.25; 

 

 

break

 

case

 0x53: 

 

 

Angle[0] = ((

short

) (chrTemp[3]<<8|chrTemp[2]))/32768.0*180; 

 

 

Angle[1] = ((

short

) (chrTemp[5]<<8|chrTemp[4]))/32768.0*180; 

 

 

Angle[2] = ((

short

)(chrTemp[7]<<8|chrTemp[6]))/32768.0*180; 

 

 

T = ((

short

)(chrTemp[9]<<8|chrTemp[8]))/340.0+36.25; 

 

 

printf(

"a = %4.3f\t%4.3f\t%4.3f\t\r\n"

,a[0],a[1],a[2]);   

 

 

printf(

"w = %4.3f\t%4.3f\t%4.3f\t\r\n"

,w[0],w[1],w[2]);   

printf(

"Angle = %4.2f\t%4.2f\t%4.2f\tT=%4.2f\r\n"

,Angle[0],Angle[1],Angle[2],T); 

 

 

break

 

5.4

 

Examples of analytical data in embedded environment 

The code is divided into two parts, one is in interrupt to receive, to find the data's head, and 

then put the packet into the array. The other is data analysis in the main code. 

Interrupt part(The following is the AVR microcontroller code. The other microcontroller will 

be a little difference) 

unsigned char Re_buf[11],counter=0; 
unsigned char sign; 
interrupt [USART_RXC] void usart_rx_isr(void) //USART receive 
  {   
            Re_buf[counter]=UDR;//

 

Slight difference between different microcontroller 

            if(counter==0&&Re_buf[0]!=0x55) return;          //

 

if the first data is not frame header, skip   

            +;   
            if(counter==11) //

 

Receive 11 data 

            {   
                  counter=0; //

 

Re assignment, prepare for the next frame of data receiving   

                  sign=1; 
            }   
  }   

Main code

 

float a[3],w[3],angle[3],T; 
extern unsigned char Re_buf[11],counter; 
extern unsigned char sign; 

Содержание JY-61 Series

Страница 1: ...ded system 5 Supports serial port Data output frequency 100Hz baud rate 115200 20Hz 9600 baud 6 Module retains MPU6050 I2C interface in order to meet the needs of advanced users to get the original da...

Страница 2: ...X axis the upper is Y axis the Z axis is perpendicular to the surface of the paper to yourself The direction of rotation is defined by the right hand rule that is the thumb of the right hand is pointe...

Страница 3: ...interface module needs to be configed as the following figure when connecting to 6050 module 4 2 Installation USB TTL module driver First the module is connected via USB TTL module to the computer in...

Страница 4: ...ramework4 0 Net http www microsoft com zh cn download details aspx id 17718 Open the PC software first click on the baud rate menu select the baud rate module the default setting is 115200 Then click...

Страница 5: ...rd the data Click the record button the software can record data to a text file click on the record button and when finish recording need to click the stop the file will be written to the hard disk th...

Страница 6: ...321 6 Data can be imported into the Exel or analysis in Matlab In the Matlab environment running xxx m document and it can plot of the data 6 Language Click on the language menu you can switch the lan...

Страница 7: ...display screen displaying three dimensional posture of the module After starting the three dimensional model the default interface is full screen and to change back to the window mode you can press th...

Страница 8: ...the JY 61 module but the configuration of the module can be saved when set it then you can use it 4 6 PC program monitoring module and MCU communication PC program and MCU can get the data from JY 61...

Страница 9: ...2 Module to PC program The module sends the data to the host computer into 3 data packets acceleration packet angular velocity packet and the angle packet and the 3 packet are sent in sequence 5 2 1...

Страница 10: ...system the X axis is East the Y axis is North Z axis toward sky Euler coordinate system rotation sequence defined attitude is z y x first rotates around the Z axis Then around the Y axis and then arou...

Страница 11: ...0 short chrTemp 3 8 chrTemp 2 32768 0 180 Angle 1 short chrTemp 5 8 chrTemp 4 32768 0 180 Angle 2 short chrTemp 7 8 chrTemp 6 32768 0 180 T short chrTemp 9 8 chrTemp 8 340 0 36 25 printf a 4 3f t 4 3f...

Страница 12: ...8 0 16 T short Re_buf 9 8 Re_buf 8 340 0 36 25 break case 0x52 w 0 short Re_buf 3 8 Re_buf 2 32768 0 2000 w 1 short Re_buf 5 8 Re_buf 4 32768 0 2000 w 2 short Re_buf 7 8 Re_buf 6 32768 0 2000 T short...

Отзывы: