EV Logger
A MSP430 based datalogger for an electric vehicle
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Typedefs | Functions | Variables
System

Typedefs

typedef uint32_t clock_time_t
 Define a type to hold a system clock time.
 

Functions

void clock_init (void)
 Use timer A0 to set up a system clock ticking at 1ms intervals.
 
void sys_clock_init (void)
 Configure the system core clock to provide a stable clock for the CPU. More...
 
clock_time_t clock_time (void)
 Return the current system time. More...
 
void _delay_ms (clock_time_t delay)
 Delay for the provided number of milliseconds. More...
 
 interrupt (TIMER0_A0_VECTOR)
 Interrupt service routine for the system ticks counter. More...
 

Variables

static volatile clock_time_t ticks
 Current clock time.
 

Detailed Description

Function Documentation

void _delay_ms ( clock_time_t  delay)

Delay for the provided number of milliseconds.

We use the __delay_cycles() function which consists of putting NOPs into the CPU pipeline for the required period.

Parameters
delayThe number of ms to delay.
clock_time_t clock_time ( void  )

Return the current system time.

Returns
The current clock time in milliseconds.
interrupt ( TIMER0_A0_VECTOR  )

Interrupt service routine for the system ticks counter.

Note that the interrupt() macro is from legacymsp430.h.

void sys_clock_init ( void  )

Configure the system core clock to provide a stable clock for the CPU.

Set up the system core clock source as the digitally controlled oscillator (DCO) and have the FLL stabilise the DCO at 25MHz with reference to the external high speed crystal XT2, which is 4MHz on the MSP-EXP430 board.