#include "OB6710.h"
#include "PWM.h"
#include "ACMP2.h"
#include "ACMP1.h"
extern bit g_PwmInterrupt;

extern void Test_DT(void);

unsigned char gTimerH, gTimerL;

void main(void)
{
	P0M0 = 0x00;
	P0M1 = 0x00;
	P1M0 = 0x00;
	P1M1 = 0x00;
	P2M0 = 0x00;
	P2M1 = 0x00;
	P3M0 = 0x00;
	P3M1 = 0x00;
  Test_DT();
	while(1);
}

void Test_DT(void)
{	
	PWM_Duty(0x0800,0x200, 0x400);
	PWM_EnableIE();
	PWM_Init();
  PWMEN = 0x3F;
	DEADTIME0 = 0xA0;	
	DISFUPL = 0x80;         
	DISFUPH = 0x00;          
	DISFDNL = 0x80;          
	DISFDNH = 0x0F;        
	PWMTBC0 = PWMTBC0 | 0x02;
	PWMPOLARITY = 0x03;
	DISCON = 0x0F;
	while(1)
	{
		 if(g_PwmInterrupt == 1)
			{
				P0_1=~P0_1;
				g_PwmInterrupt = 0x00;
				gTimerH = TBCOUNTERH;
				gTimerL = TBCOUNTERL;
			}
	}
}