Jump to content
43oh

MSP432 RTC User adjust


Recommended Posts

can anyone some help me? 
I have some problems with user rtc configuration in msp432 I made  a firmware where the user choose by hardware configuration adjust date and time (alarm clock). The problem is ... after the user adjust date and time I would like use the rtc to control the watch and show the current date and time in a lcd. The problem is ... after the user adjust date and time I would like use the rtc to control the watch and show the current date and time in a lcd. Soo i need some help in two things pass the user value (decimal) to hexadecimal or BCD and the inverse get the hexadecimal or BCD value to decimal to show in LCD . I'am using CCS, in CMSIS on attach i leave the code I have made to test it!

test.zip

Link to post
Share on other sites

Hi @biza

This two conversions are quite simple to do.

Decimal to BCD (considering a number between 0 and 99)
- Divide the number by 10
- take te result and shift left 4 places
- take the modulo of division (%) by 10
- add the reminder to the left shifted value

BCD to Decimal (considering a number between 0 and 99)
- Shift right 4 places and multiply by 10
- apply a "AND" opperation between the number and "0xF" to isolate the lowest nible, then, add to last number

This video show this:
https://www.youtube.com/watch?v=nieuAryQ2SI

Link to post
Share on other sites
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...