// _HC12Setup.c

#include "912d60.h"
#include "kernel.h"

 

void _HC12Setup(void) {

	 
	 // set the register base
	 //*(volatile unsigned char *)0x0011 = 0x08;
	 
	 // set up the SYSTEM CLOCKS
	 //SLOW = 0x00;  		  			// don't slow the RTI/COP clocks down
	 
	 	 
	 // set up the RTI INTERRUPT
	 INTR_OFF();		  			// disable/mask all maskable interrupts
	 RTICTL = 0x86;			  	 	// enable RTI at 65.536 miliseconds
	 //RTICTL = 0x85;					// enable RTI at 32.768 miliseconds
	 RTIFLG = 0x80;					// clear real time interrupt flag
	 
	 
	 // set up the COP WATCHDOG clock monitor for 524.288 ms
	 COPCTL = 0xC5; 			// COP on
	 //COPCTL = 0x00;	   		// COP off
	 
	 
	 // set up the TOF interrupt
	 TMSK2  = 0x80;			  // set to interrupt at 16.384 miliseconds
	 TSCR   = 0x80;			  // enable the timer
	 PACTL |= 0x0C;			  // ensure the timer is clocked from mclock divider
	 HPRIO  = 0xDE;			  // elevate the TOF interrupt
	 
	 
	 /*// set up the MDC interrupt for time_tick
	 HPRIO = 0xCC; 	   			 // elevate to highest priority
	 TSCR  = 0x00;				 // setup
	 MCCNT = 0x0000;   			 // modulus down-count start point
	 MCCTL = 0xC4;				 // enable
	 */
	 
}

