当前位置:网站首页>Abnormal analysis of pcf8591 voltage measurement data
Abnormal analysis of pcf8591 voltage measurement data
2022-06-27 14:22:00 【Old man in charge】
Problem description : after ad After the transformation , Convert data into voltage value , And display the voltage value on the nixie tube . But the nixie tube can display 5.44.
Problem analysis : In general , I think it's the error from integer to floating point , But when you think about it, it shouldn't exist in two decimal places .
Problem solving : After a long time of thinking , I found that the data may have overflowed :
// The data I define is unsigned char
// The biggest data received is 255
// Because the decimal number should be displayed on the nixie tube , So I enlarged the data 100 times , The data processing is as follows
unsigned char dat_in;
smg_set(0,0,0,0,0,dat_in/51,(dat_in*100/51)%100/10,(dat_in*100)/51%10);
// It's not hard to find out , Most likely in (dat_in*100)/51 Overflow occurred in the process of
So the solution is to change to unsigned int Slightly .
beautiful !!! Clean and hygienic oh !!!!
边栏推荐
- QT 如何在背景图中将部分区域设置为透明
- Dynamic Networks and Conditional Computation论文简读和代码合集
- A method to realize automatic renaming of pictures uploaded by WordPress
- Pytorch learning 1 (learning documents on the official website)
- CV领域一代宗师黄煦涛教授86岁冥诞,UIUC专设博士奖学金激励新锐
- 初识云原生安全:云时代的最佳保障
- Step by step expansion of variable parameters in class templates
- 做一篇人人能搞懂的ThreadLocal(源码)
- Why must Oracle cloud customers self test after the release of Oracle cloud quarterly update?
- Array related knowledge
猜你喜欢
以前国产手机高傲定价扬言消费者爱买不买,现在猛降两千求售
[WUSTCTF2020]girlfriend
How to select cross-border e-commerce multi merchant system
[安洵杯 2019]Attack
Half find (half find)
[PHP code injection] common injectable functions of PHP language and utilization examples of PHP code injection vulnerabilities
Redis 主从复制、哨兵模式、Cluster集群
QT 如何在背景图中将部分区域设置为透明
Pisa-Proxy 之 SQL 解析实践
赛迪顾问发布《“十四五” 关键应用领域之数据库市场研究报告》(附下载)
随机推荐
buuctf misc 百里挑一
Li Kou's 81st biweekly match
Half find (half find)
【每日3题(3)】盒子中小球的最大数量
Awk concise tutorial
Is there any discount for opening an account now? Is it safe to open an account online?
Step by step expansion of variable parameters in class templates
Why must Oracle cloud customers self test after the release of Oracle cloud quarterly update?
高德地图IP定位2.0备份
AcWing 第57 场周赛
522. 最长特殊序列 II / 剑指 Offer II 101. 分割等和子集
国产数据库乱象
In the past, domestic mobile phones were arrogant in pricing and threatened that consumers would like to buy or not, but now they have plummeted by 2000 for sale
EventLoop learning
[advanced MySQL] MTS master-slave synchronization principle and Practice Guide (7)
[business security-02] business data security test and example of commodity order quantity tampering
基于 xml 配置文件的入门级 SSM 框架整合
CMOS level circuit analysis
Domestic database disorder
[problem solving] which nodes are run in tensorflow?