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.

[参考译文] MSP430FR5959:RTC BIN2BCD和BCD2BIN

Guru**** 2382480 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/637610/msp430fr5959-rtc-bin2bcd-and-bcd2bin

部件号:MSP430FR5959

是否可以在 不使用RTC的情况下使用BIN2BCD和BCD2BIN? 例如 ,在MSP430FR5959IDAR上。

在调试中,所有RTC寄存器视图均为0x3FFF;

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好,

    您尝试使用BIN2BCD和BCD2BIN寄存器的目的是什么? 这些寄存器也适用于某些其它外设,如ADC。

    此致,
    Nathan
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    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 -对不起,您的问题未解决,意外按下了此按钮

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好,

    只有正确配置RTC,才能使用这些寄存器。 如果您不想使用RTC (在您描述的情况下可能不会使用),则您将无法使用这些寄存器。 您需要自己编写这样的函数。

    此致,
    Nathan