B4R Code Snippet STM32 - With int/ext RTC and LCD

The attached two applications display real time on LCD 1602 (or similar - just find the address).
stm_clock_lcd uses the internal clock of the stm32 and with the addition of an Encoder it can modify the time and set it while running. The encoder is used by clicking the switch to select which parameter to change by rotating the knob (parameter name is displayed).
stm_RTC1302_LCD connects the stm to realtime external clock - the ds1302.
Probably due to working with 32 bits, the reading every second time is incorrect so it uses a 1 sec addition to the previous reading instead of using that reading. So the workaround for this problem is in the b4r code, maybe someone can adjust the rds1302 library for the stm32 case...
Thanks to Starchild https://www.b4x.com/android/forum/threads/software-real-time-clock.77158/ for the STM32 in general and the RTC specifically ,
to Peter Simpson https://www.b4x.com/android/forum/threads/using-an-incremental-rotary-encoder.79611/ for the encoder.

Edit: file stm_rtc1302_lcd updated.
Edit: see post 2 and 3.
 

Attachments

  • stm_clock_lcd.zip
    1.7 KB · Views: 468
  • stm_RTC1302_LCD.zip
    1.4 KB · Views: 457
Last edited:

derez

Expert
Licensed User
Longtime User
The RTS1302 application fails after long time (1-2 hours) with this:
Out of bounds error. Array length = 7, Index = 82
I have no idea where it happens so I guess it is something with the library operation in stm32.
I'll write another application which shall use the internal RTC, updating it by the ds1302 at start.
 

Similar Threads

Top