RFQ/BOM 0 登入 / 注册

选择您的位置

用户形象

How to compare the voltage results collected by the MCU twice?

MCU
七月 08, 2020 by West 607

I would like to ask, if the voltage collected by the microcontroller for the first time is 1.77v, and the second collection is carried out after ten minutes, the collected voltage is 1.76v, the single chip can collect the voltage collected for the second time and the first collection To compare the voltage? (The second collected voltage is greater than the last collected voltage is calculated as 1, the second collected voltage is less than the first collected voltage is calculated as 0) Then by analogy, each collected voltage is equal to Compare the voltage collected last time, and compare the results. I hope to see the great god can help me, grateful!

所有评论

user image

Shelley 发表于 July 8, 2020

Set two buffers, one comparison result flag

The last put in buf[0], the latest put in buf[1]

Compare the relationship between buf[0] and buf[1] according to your logic, whether the flag is 1 or 0

Then set buf[0] = buf[1]; to wait for the next comparison.

0
  • West

    West 发表于 July 8, 2020

    Thanks for your help, so I know how to communicate with the engineer, thank you very much.

  • 您需要登录才能回复。 登入 | 注册

user image

Mayer 发表于 July 8, 2020

If you don't need to save it after power-off, you can use the variable to save and compare and replace.

0

写一个答案

您需要登录才能回复。 登入 | 注册