OpenCores
URL https://opencores.org/ocsvn/openmsp430/openmsp430/trunk

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [fpga/] [altera_de0_nano_soc/] [software/] [libs/] [tA/] [timerA.c] - Rev 221

Compare with Previous | Blame | View Log

#include "omsp_system.h"
#include "timerA.h"
 
//---------------------------------------------------//
//    TA_WAIT_NO_LPM                                 //
// ( the function implements a wait by continously ) //
// ( polling the TAR register                      ) //
//                                                   //
//---------------------------------------------------//
void ta_wait_no_lpm(unsigned int time_cnt) {
 
  // Start and re-initialize TimerA
  TACTL = TASSEL0 | TACLR | MC_2;
 
  // Wait until time is over
  while(TAR < time_cnt);
 
}
 
//--------------------------------------------------//
//    WAIT FUNCTION                                 //
// ( the function brings the core to LPM0 state )   //
// ( the timerA IRQ will exit the LPM0 state    )   //
//                                                  //
//--------------------------------------------------//
void ta_wait(unsigned int time_cnt) {
 
  // Set time limit for IRQ generation
  TACCR0 = time_cnt;
 
  // Start and re-initialize TimerA
  TACTL  = TASSEL0 | TACLR | MC_1 | TAIE;
 
  // Go to Low-Power-Mode 0
  LPM0;
 
}
 
//--------------------------------------------------//
//    TIMER A INTERRUPT                             //
//--------------------------------------------------//
wakeup interrupt (TIMERA1_VECTOR) INT_timerA1(void) {
 
  // Clear the receive pending flag & stop timer A
  TACTL = TAIFG;
 
  // Exit the low power mode
  LPM0_EXIT;
}
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.