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 and BCD2BIN

Part Number: MSP430FR5959


possible to use BIN2BCD and BCD2BIN without use RTC? on MSP430FR5959IDAR for example.

in debug all RTC register view as 0x3FFF;

  • Hi,

    What are you trying to use the BIN2BCD and BCD2BIN registers for? Those registers exist for some other peripherals as well, such as the ADC.

    Regards,
    Nathan
  • ADC not have this registers.
    I planing use this register for fast convert integer to string and string to integer, whithout many divide by 10

    For example. have integer 4321 and need send as string "4321" (standart LCD for example)

    put 4321 to BIN2BCD and read form BIN2BCD BCD code

    save this code to string 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;

    and have in str = "0x34,0x33,0,x32,0x31"

    code in teory, not checked (but need optimization)

    Also use for quick divide by 10, 100, 1000

    put BIN2BCD, read  BIN2BCD, shift 4,8,12 bit, put to BCD2BIN, read div int - bingo :)

    PS - pardon, your ansver not resolved my issue, accidentally pressed this button

  • Hi,

    You can only make use of these registers if the RTC is configured properly. If you do not want to use the RTC (as you probably wouldn't in the case that you described), then you would not be able to use those registers. You would need to write such a function yourself.

    Regards,
    Nathan

**Attention** This is a public forum