MCU queue C language OLED oscilloscope heart rate waveform display MSP430F5529 plusesensor ADS1292R

Considering the refresh speed of the OLED display, the OLED screen must be driven by hardware SPI.

OLED oscilloscope, the array data[128] indicates that the length of the array is 128, that is, the OLED has 128 columns, each column has a value, and the value is the ordinate, 0~63. If you use the queue to implement the oscilloscope:
(1) The sensor has a new one If the queue is full, delete the head of the queue, and then insert new data to the end of the queue.
(2) OLED refresh is to traverse all elements of the queue.

Taking into account the effect of heart rate display, although the sensor sampling speed is very fast, the time point of inserting new data into the queue needs to be controlled. For example, when new data is written to the queue in 10ms, the entire screen cycle is 1270ms.

In this case, it is still moving one data at a time, and the effect of heart rate refresh is unknown. If you want the heart rate display to move forward throughout the entire segment, for example, after five new data points, refresh the screen once. The display effect will be different again. In this case, the movement conditions must be followed when creating a new queue.

With the help of the above ideas and the realization of https://blog.csdn.net/song_hui_xiang/article/details/47146503 , to complete this design.

Signal uses ADC to collect 0 to 4095. With plusesensor, the collected value is generally above 800 and below 3000. It is well normalized to pickup from 0 to 63: when temp = 64 - ((Signal - 800) / (2200 / 62));
new data is ECG_moveavailable, it (data_count == ECG_move)will refresh the display.


#pragma vector = ADC12_VECTOR
__interrupt void ADC10(void)
{
    
    
    Signal = ADC12MEM0;
}

#pragma vector=TIMER1_A0_VECTOR
__interrupt void TIMER1_A0_ISR(void)
{
    
    
    unsigned char temp;
    static char data_count = 0;

    if (Signal > 800)
    {
    
    
        temp = 64 - ((Signal - 800) / (2200 / 62));
        if (temp < 64)
        {
    
    
            AddQ(q, temp);                     //添加新数据
            data_count++;
        }
    }

    if (data_count == ECG_move)
    {
    
    
        data_count = 0;
        PrintQueue_len128(q);                     //刷新显示
    }
}

Insert picture description here

Insert picture description here

Similarly, the data collected by ADS1292R can be added to the queue for display according to time.

Guess you like

Origin blog.csdn.net/x1131230123/article/details/108722830