EasyManuals Logo

Texas Instruments MSP430 Student Guide

Texas Instruments MSP430
398 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #176 background imageLoading...
Page #176 background image
Lab 4a Program the MSP430 Clocks
Initialization Code - Three more simple changes
11. Use the simple initialization “template” to organize your setup code.
We’ve outlined the 3 areas you will need to adapt to create a little better code organization.
// --------------------------------------------------------------------
// main.c (for lab_04a_clock project)
// --------------------------------------------------------------------
//***** Header Files **************************************************
#include <driverlib.h>
#include "myClocks.h"
//***** Prototypes ****************************************************
void initGPIO(void);
void initPowerMgmt(void);
//***** Defines *******************************************************
#define ONE_SECOND 800000
#define HALF_SECOND 400000
//***** Functions *****************************************************
void main (void)
{
// Stop watchdog timer
WDT_A_hold( WDT_A_BASE );
//Initialize Power Management
initPowerMgmt();
//Initialize GPIO
initGPIO();
//Initialize clocks
initClocks();
while(1) {
// Turn on LED
GPIO_setOutputHighOnPin( GPIO_PORT_P1, GPIO_PIN0 );
// Wait
_delay_cycles( ONE_SECOND );
// Turn off LED
GPIO_setOutputLowOnPin( GPIO_PORT_P1, GPIO_PIN0 );
// Wait
_delay_cycles( ONE_SECOND );
}
}
//******************************************************************
void initGPIO(void) {
// Set P1.0 to output direction
GPIO_setAsOutputPin( GPIO_PORT_P1, GPIO_PIN0 );
}
void initPowerMgmt(void) {
// Set core voltage level to handle 8MHz clock rate
PMM_setVCore( PMM_BASE, ____________________________ );
}
Since the setup
code is now
organized into
functions,
prototypes need
to be included
for them
This follows
the init code
‘template’
discussed in
class
Create GPIO
and
PowerMgmt
functions
referenced
above
To fill in the
blank, refer to
Worksheet
Question #4
4 - 50 MSP430 Workshop - MSP430 Clocks & Initialization

Table of Contents

Other manuals for Texas Instruments MSP430

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments MSP430 and is the answer not in the manual?

Texas Instruments MSP430 Specifications

General IconGeneral
BrandTexas Instruments
ModelMSP430
CategoryMicrocontrollers
LanguageEnglish

Related product manuals