EV Logger
A MSP430 based datalogger for an electric vehicle
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions | Variables
system.c File Reference

Handles intrinsic system functionality such as controlling the CPU core clock and ensuring its stability, providing a real time "wall clock" source, etc. More...

#include <in430.h>
#include "HAL_PMM.h"
#include "system.h"

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

Handles intrinsic system functionality such as controlling the CPU core clock and ensuring its stability, providing a real time "wall clock" source, etc.

The core clock is generated using onboard equipment, with the reference being an external 4MHz high precision crystal. Since the core clock frequency is much higher than the reference, a frequency locked loop (FLL) system is paired with a digitally controlled oscillator (DCO) to provide a stabilised source via feedback. This system is fantastically complicated and reading of the datasheet (specific to the F5529) is recommended before attempting to understand what is going on in this module!

Author
Jon Sowman, University of Southampton j.sow.nosp@m.man@.nosp@m.soton.nosp@m..ac..nosp@m.uk