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:


Code Composer Studio : Grace !!!


I recently learned about this wonderful graphical user interface(GUI) called Grace which is a part of the Code Composer Studio by Texas Instruments. I must tell you that the interface is simply amazing. I mean you can initialize all the peripherals, interrupt subroutines, interrupt handling, etc using this interface. I tried this 1 sec delay program using grace and was amazed at the fact that TI has literally make it a cake walk for programmers to initialize all peripherals and interrupts in c language. I like writing code in assembly language and for that matter even in c, but as you would come to know while programming in c you need to use some explicit functions defined by the compiler to write the various interrupt subroutines. So if you want to focus on whether your concept is correct or not and want to do testing then grace is a blessing for you. Once you know that your code is working using grace, you can anytime write the assembly language program( initializing all the peripherals using their command registers, handle the interrupt vector addresses and so on).

I’ll be covering how to make a project using grace in CCS very soon.