haka 0 Posted February 12, 2014 Share Posted February 12, 2014 Hi, I made an application with my msp430G2452 with the timer but the precision is very low and my application witch give minutes have an error after a certain time so I would like to know how to use the external quartz of 32.768kHz in order to improve the precision of the clock. What code to put for an interruption each seconds with the quartz of 32768Hz? I'm not very good with the different clock of the msp430 and I would also like to know more about it with a link to a tutorial or some explanations. Quote Link to post Share on other sites
enl 227 Posted February 12, 2014 Share Posted February 12, 2014 Lots of resources are available. I would start with the samples included with CCS. There are also a number of projects here that use the 32KHz crystal. Questions for you: How much experience do you have programming? Do you have experience programming to handle interrupts? Do you understand the clock system for the MSP430? What literature have you read so far? There is a thread here with a bunch of links for beginners (use search), but one source I have found helpful is the BYU CS124 site (google for it... try the terms 'BYU MSP430 CS124'), especially their resources page. Without more information from you, I can't really give you a lot of help, nor can anyone else. Quote Link to post Share on other sites
haka 0 Posted February 13, 2014 Author Share Posted February 13, 2014 Hi, thanks for replying. I have a year of practice on 16F84 and 16F876, and many years programming in different langages. Interrupts have no secret for me with PIC16F familly but I didn't read a complete course on MSP430 so I have many gaps on it. So I don't really understand the clock system for the MSP430 and I think that with a proper tutorial I might be able to increase my knowledge on MSP430. Quote Link to post Share on other sites
colotron 5 Posted February 13, 2014 Share Posted February 13, 2014 Hi, ... I would like to know how to use the external quartz of 32.768kHz in order to improve the precision of the clock. What code to put for an interruption each seconds with the quartz of 32768Hz?... Take a look at the code examples provided for msp430g2452, they show the minimum configuration needed to make the peripherals work: http://www.ti.com/lit/zip/slac467 And also the wiki: http://processors.wiki.ti.com/index.php/MSP430G2_LaunchPad The readme file at "C" folder describes the examples. If you want to trigger interruptions using the 32768 crystal see msp430g2xx2_ta_04.c Quote Link to post Share on other sites
enl 227 Posted February 13, 2014 Share Posted February 13, 2014 Ok. That gives me a guide for a recommendation Search out "Launchpad Workshop" from TI. The current version is 2.21, I think. There is a PDF of the lessons, and associated file package with the sample code, though most is built in the text. It is Code Composer oriented. Also see http://forum.43oh.com/topic/28-32k-crystal-install-and-test/ for test code. There are a couple other versions of test code around. This shows the setup, but not use for timed interrupt. Again, the examples that are in the example files that ship with CCS (buried in the directory tree without any easy index) are very, very useful. Quote Link to post Share on other sites
rockets4kids 204 Posted February 13, 2014 Share Posted February 13, 2014 Note that even when using a 32 kHz xtal you are still going to have difficulty achieving the accuracy of the cheapest digital clock from wal*mart. To make a decent clock with the MSP430, you are going to need to calibrate it and apply temperature compensation. If you need any kind of long-term accuracy, and you don't want to futz around with calibration, take a look at one of the RTC chips out there. Expect to pay $3-$10 depending on the level of accuracy you need, but this is trivial compared to the amount of time you will spend futzing otherwise. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.