1sec delay using 32Khz crystal and Grace!!!


I tried to experiment with a video tutorial this time. So I won’t be like writing the steps down but instead will show you how this grace magic works visually.

Something to know about the 32.768 KHz crystal that came along with your launchpad. You might be wondering why this crystal and upon that why this precise value?? The answer is simple we need external crystal to give precise clock pulses (i.e heart beats of your processor). There is an inbuilt digital controlled oscillator in msp430, but then this does not give frequency stable enough for precise operations for example a real time clock. Now regarding the 32768 Hz value. 65536 is a number that makes sense to most people who have experience with memories. Maximum 16bit data is 0FFFFh or 11111111b or 2^16 i.e 65532d and exactly half of that is 32768. So if you count every pulse generated by this crystal (counter action using Timer A), after you’ve reached 32768 counts you would have waited 1 sec exactly. Isn’t this really amazing?? Now that you have 1 sec, I don’t think there is any need for me to tell you the importance of 1 sec right??  Anyways one of the most basic and fundamental operation of this is in real tune clock(RTC) chips.

So in this program we’ve tried to see this one second delay using whatever resources we have on launchpad i.e LED1 and LED2. We’ll be toggling the led’s exactly after 1 sec.

And we should not forget the main motto i.e learning grace. So we’ll use grace to create this project. Hope this post was informative and useful for you. Thank you for reading this.

The tutorial link is(I’ll try to be more clear next time :D):

The led video link: