Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Example Analysis of JY901 NOTES TM4 Serial Port data Reading

Shulou Source: shulou.com Published: 2022-06-01 03:08:32 10月04日 Update

This article is to share with you the content of an example analysis of JY901 NOTES TM4 serial data reading. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Serial port reading module data

Here I attach my serial data reading function which is modified on the basis of the routines provided by the manufacturer (although it is very simple, it can save the time of the brother who sees the post).

First, TM4 serial port 1 initializes:

# define UART1Baud 115200void initUART1 () {ROM_SysCtlPeripheralEnable (SYSCTL_PERIPH_GPIOB); ROM_SysCtlPeripheralEnable (SYSCTL_PERIPH_UART1); ROM_GPIOPinConfigure (GPIO_PB0_U1RX); ROM_GPIOPinConfigure (GPIO_PB1_U1TX); ROM_GPIOPinTypeUART (GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1) ROM_UARTConfigSetExpClk (UART1_BASE, ROM_SysCtlClockGet (), UART1Baud, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); ROM_IntEnable (INT_UART1); UARTFIFODisable (UART1_BASE); UARTIntRegister (UART1_BASE,UART1_Handler); ROM_UARTIntEnable (UART1_BASE,UART _ INT_RX | UART_INT_RT);}

Then interpret it according to the agreement of the manual:

Float roll=0,pitch=0,yaw=0; float accX=0,accY=0,accZ=0; float gyrX=0,gyrY=0,gyrZ=0 Void JY901_GetOneByte (U8 data) {static U8 ucRxBuffer [12]; static U8 ucRxCnt=0; ucRxBuffer [ucRxCnt++] = data; if (ucRxBuffer [0]! = 0x55) {ucRxCnt=0; return } if (ucRxCnt

Tags: Serial port data magnetic force magnetometer example analysis content original factory post more module article good practical anxious punctual awkward turn around function manufacturer Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Microsoft Shulou Tech Info Huawei Redmi