Panasonic MN103S65G Cell Phone User Manual


 
2-4 A 8-bit 16-bit timer, a peripheral initial
#define TM0_COUNT4 3 /* cycles/min ratio setup (4 cycles/min -1) */
#define TM0MD_LOAD1 0x07 /* TMIN0 Terminal input setup */
#define TM0MD_STABLE1 0x00 /* stabilization */
#define TM0MD_START1 0x40 /* timer start */
#define TM0MD_ENABLE1 0x80 /* timer permission*/
#define PS0MD_STOP 0x00 /* pre-scaler stop */
#define PS0MD_START 0x80 /* pre-scaler start*/
#define TM1MD_STOP 0x00 /* timer stop*/
#define TM1_COUNT3 5 /* cycles/min ratio setup (5 cycles/min -1) */
#define TM1MD_LOAD1 0x03 /* load cycles/min ratio*/
#define TM1MD_STABLE1 0x00 /* stabilization */
#define TM1MD_START1 0x40 /* timer start */
#define TM1MD_ENABLE1 0x80 /* timer permission*/
#define PS0_COUNT200 199 /* cycles/min setup (200 cycles/min-1) */
#define TM0_COUNT0x5f 0x5f /* cycles/min setup (0xea5f = 0xea60(60000) - 1) */
#define TM1_COUNT0xea 0xea /* cycles/min setup (0xea5f = 0xea60(60000) - 1) */
#define TM0MD_LOAD2 0x42 /* read cycles/min ratio */
/* clock source (pre-scaler 0 clock ) setup */
#define TM1MD_LOAD2 0x03 /* timer 0 and cascade connection*/
#define TM0MD_STABLE2 0x02 /* stabilization*/
#define TM1MD_STABLE2 0x01 /* stabilization*/
#define TM0MD_START2 0x82 /* timer start*/
#define TM1MD_START2 0x81 /* timer start */
/***********************************************
* Interval timer by 8-bit timer
* Pre-scaler 0 is used, and the cascade connection of the timers 0
* and 1 is carried out, and it is used as a 16-bit timer.
***********************************************/
void initInterval8( void )
{
unsigned short data0,data1;
TM03PSC = PS0MD_STOP; /* pre-scaler stop*/
TM0MD = TM0MD_STOP; /* timer stop*/
TM1MD = TM1MD_STOP; /* timer stop*/
/* Setup of timer cycles/min ratio 60000-1 */
TM0BR = TM0_COUNT0x5f; /* cycles/min setup 0xea5f=59999 */
TM1BR = TM1_COUNT0xea; /* cycles/min setup*/
data0 = 0;
TM0MD = data0; /* Arbitrary setup */
data1 = TM1MD_LOAD2;
TM1MD = data1; /* timer 0 and cascade setup */
data0 |= TM0MD_START1;
TM0MD = data0; /* Timer 0 initialization LDE=1 */
data1 |= TM1MD_START1;
TM1MD = data1; /* Timer 1 initialization LDE=1 */
data0 &= ~TM0MD_START1;
TM0MD = data0; /* Timer 0 start LDE=0 */
2-36