[英]Display hex values on LCD using 8051 MCU
I have calculated TH1=0xA5,TL1=0xFE
by ultrasonic sensor on. 我已经通过超声波传感器计算出
TH1=0xA5,TL1=0xFE
。 I want to display it on a LCD (16*2) like A5FE
using an 8051 MCU. 我想使用8051 MCU在
A5FE
类的LCD(16 * 2)上显示它。 My problem is that I'm using an integer value for displaying on the LCD. 我的问题是我正在使用整数值在LCD上显示。
Now I want to create a variable a
which will contain the value 0xA5FE
, that is a=0xA5FE
. 现在,我想创建一个变量
a
,它将包含值0xA5FE
,即a=0xA5FE
。 How can I combine the value of TH1 and TL1? 如何合并TH1和TL1的值?
假设TH1,TL1是uint8_t
:
uint16_t a = ((uint16_t)TH1 << 8) | TL1;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.