This application note presents a software solution using the frequency of the European standard mains (220V/50Hz) as a timebase to adjust the internal RC oscillator of the ST7FLITE0 microcontroller.
The document details a method to trim the RC oscillator of the ST7FLITEO microcontroller to a specific frequency with 1% accuracy. It presents a software algorithm that uses the European (220V/50Hz) or US (110V/60Hz) mains frequency as a timebase to adjust the oscillator via the RCCR register. The note provides two software versions: a basic version requiring less than 90 bytes of program memory and an average version for noisy mains environments.
| Oscillator Accuracy | 1% |
|---|---|
| Basic Version Memory | less than 90 bytes of program memory |
| Basic Version RAM | five bytes of RAM |
| Basic Version Calibration Time | less than 160 ms |
| Average Version Memory | 136 bytes of program memory |
| Average Version RAM | 11 bytes of RAM |
| Average Version Calibration Time | less than 560 ms |
The purpose is to present a software solution using the frequency of the European standard mains (220V/50Hz) as a timebase to adjust the internal RC oscillator of the ST7FLITEO to 1 MHz (1%).
The software uses the mains frequency as a timebase to test if the RC oscillator frequency is above or below 1 MHz and repeatedly transforms it by dichotomous analysis so that in 7 iterations the RCCR is set to the optimum value.