6 years, 11 months ago.

RTC problem with LPC1768

I'm a beginner with LPC1768, and from the datasheet I found that there's a RTC in it. And my problem is that if i want to use the internal RTC to get the real time, what code shall I write in compiler? Do I need to set the time and the date?

1 Answer

6 years, 11 months ago.

You need to do it like this: https://developer.mbed.org/handbook/Time, that uses the RTC. You do need to set the time, since it is just a simple counter in the end. So if you unplug your device, and also the battery backup voltage (the Vbat pin, typically not connected), it will lose its time.

And I found that in some website, they said a 32kHZ crystal is needed, but when I compile the code (from the website you gave me) to my LPC1768 without crystal, it worked really good. So the I don't need that crystal right??

posted by Ken Tuen 11 May 2017

Do you have the mbed LPC1768? Because that one does have a 32kHz crystal onboard. Without crystal I don't think there is an alternative clock it gets.

posted by Erik - 11 May 2017