是否可以在 不使用RTC的情况下使用BIN2BCD和BCD2BIN? 例如 ,在MSP430FR5959IDAR上。
在调试中,所有RTC寄存器视图均为0x3FFF;
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
是否可以在 不使用RTC的情况下使用BIN2BCD和BCD2BIN? 例如 ,在MSP430FR5959IDAR上。
在调试中,所有RTC寄存器视图均为0x3FFF;
ADC没有此寄存器。
我计划使用此寄存器将整数快速转换为字符串,将字符串快速转换为整数,其中除以10
例如,具有整数4321,需要作为字符串"4321"发送(例如标准LCD)
将4321放入BIN2BCD并读取BIN2BCD BCD代码
将此代码保存到字符串unsigned char str[4]
str[3]=(unsigned char)(BIN2BCD & 0x000F)& 0x30;
str[2]=(unsigned char)(BIN2BCD & 0x00F0 >> 4)& 0x30;
str[1]=((unsigned char)(BIN2BCD >> 8)& 0x0F) 和0x30;
str[0]=((unsigned char)((BIN2BCD >> 8)& 0xF0)>>4)& 0x30;
并且str中的包含="0x34,0x33,0,x32,0x31"
存储库中的代码,未选中(但需要优化)
也可用于快速除以1.01万,1000
put BIN2BCD, read BIN2BCD, shift 4,8,12 bit,put to BCD2BIN, read div int - bingo :)
PS -对不起,您的问题未解决,意外按下了此按钮