#include <hidef.h> /* common defines and macros */
#include "derivative.h" /* derivative-specific definitions */
void DoubleOutputInit(){
TIOS=0X01; //Channel 0 output compare
TSCR1=0X90; //Timer enable
TTOV=0X01; //Timer Toggle On Overflow Enable;
TCTL2=0X02; //OutPut zero
TSCR2=0X07; //Prescaler Factor=128
TC0=0X7fFF; //设置TC0=65536/2
}
void main(void)
{
/* put your own code here */
DDRB=0XFF;
PORTB=0XFF;
DoubleOutputInit();
EnableInterrupts;
for(;;)
{
while(PTT_PTT0==0)
PORTB=0X00;
while(PTT_PTT0==1)
PORTB=0XFF;
_FEED_COP(); /* feeds the dog */
} /* loop forever */
/* please make sure that you never leave main */
}