Reply to topic

Generating a 1 Pulse Per Second using MSP430

omerd
Registered Member
Posts
1
Karma
0
Hello ,
I'm new in Micro Controller field and i have been doing some readings (along with some relevant DataSheets) , although i still didn't understand few things .
I'm using MSP430F5131 and attached an external crystal of 12.8MHz to pins PJ.4 and PJ.5 .
I would like to generate a 1 pulse per second using this external clock while the output of the 1pps should be P2.4 , im also using Timer D (TD0.0) .

Could you help me writing the code (I'm using Code Composer Studio) about how to generate that 1 pps using the external crystal and Timer D (TD0.0) and how to define the timer d and external crystal.

thanks in advance.
User avatar scummos
Global Moderator
Posts
1014
Karma
7
OS
You're in the completely wrong forum. Try embdev.net or so, this is completely unrelated to everything on this board.

Typically though, you have to
- enable the external crystal input,
- set the external clock as input for your timer,
- pick a suitable prescaler for the timer increment (e.g. 128 sounds good for this),
- set up a timer compare unit to trigger when the timer counted for one second (e.g. 100 000 with 12.8 MHz and 128 prescaler)
- configure the timer compare unit to toggle a pin on match.

How to do that is all described in your controller's user manual.

Note though that crystal oscillators are not very good clock sources (in fact, they are quite bad) and the PPS signal you produce that way will be fairly low-quality.

Greetings,
Sven


I'm working on the KDevelop IDE.

 
Reply to topic

Bookmarks



Who is online

Registered users: AceMcCrank, Bing [Bot], Exabot [Bot], formyfriday, Google [Bot], jackdinn, louis94, Sogou [Bot], Yahoo [Bot]