Arithmetic operation \t character: take the remainder (modulo)%--I will modify the editor 2

In the htm editor, it is not supported to write formulas through $. $ only supports markdown format. In html, you need to use methods such as " \(expression)\ ", but block-level formulas can be written through " $$expression$$" is written in this way,

Note: Test post, later CSDN will reply to perfect


1. The new version of \(a + b\) cannot display the formula in the line \(sum_{x\in X} \theta_c^x = 1\), <img src="http: //www.forkosh.com/mathtex.cgi?$a+b$">Solution:

Here is the inline formula: $$Gamma(n) = (n-1)!\quad\forall n\in\mathbb N$$

\(\sqrt {{a^2} + {b^2}}\)


Simulate serial data transfer

(Referring to some online ideas, I would like to express my thanks here~) dada
have to be aware of is:   
    For unsigned numbers, both left and right shifts are logical shifts, that is, left-shifted low-order bits are filled with 0, and right-shifted high-order bits are filled with 0;
    for signed numbers, arithmetic is used. Shifting, the extra left shift will move into the sign bit, and the right shift is an arithmetic right shift under the gcc compiler, that is, the vacated high-order complement sign bit.

#include < stdlib.h >
#include < stdio.h >
typedef unsigned char uint8;
typedef unsigned int uint32;
int main(void) {
    uint32 num1 = 12345678,
    num2;
    int num3 = -12345678,
    num4;
    float num5 = -1234.567,121212
    num6;
    uint8 TxBuf1[4];
    char TxBuf2[4];
    int i;
     //------------------------------------------------ Serial port sends unsigned integer TxBuf1[0] = num1;// printf("TxBuf[0] = 0x%x\n",TxBuf[0]); TxBuf1[1] = num1 >> 8; // printf(" TxBuf[1] = 0x%x\n",TxBuf[1]); TxBuf1[2] = num1 >> 16;// printf("TxBuf[2] = 0x%x\n",TxBuf[2]) ; TxBuf1[3] = num1 >> 24;// printf("TxBuf[3] = 0x%x\n",TxBuf[3]); num2 = ((uint32)TxBuf1[0] | (uint32)TxBuf1[ 1]<<8 | (uint32)TxBuf1[2]<<16 | (uint32)TxBuf1[3]<<24); printf("num2 = %d\n",num2); //----- ---------------------------------------------- Serial port sends signed integer TxBuf2[0] = *((int *)&num3); TxBuf2[1] = *((int *)&num3) >> 8; TxBuf2[2] = *((int *)&num3) >> 16; TxBuf2[ 3] = *((int *)&num3) >> 24; num4 = *((int *)TxBuf2); printf("num4 = %d\n",num4);//------------------------------------------------ Serial port sends floating point number TxBuf2[0] = *((int *)&num5); TxBuf2[1] = *((int *)&num5) >> 8; TxBuf2[2] = *((int *)&num5) >> 16; TxBuf2[3] = *((int *)&num5) >> 24; num6 = *((float *)TxBuf2); printf("num6 = %f\n",num6);
    //------------------------------------------------ Serial port sends floating point number char *p = (char *)&num5; for(i = 0;i < sizeof(float);i++) TxBuf2[i] = *p++;
    num6 = *((float * ) TxBuf2);
    printf("num6 = %f\n", num6);
    return 0;
}
operation result:

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325480916&siteId=291194637