#include <stdio.h>
#include <string.h>
#include "command.h"
#include "AD18F06A.h"


void timer3_PWM2(void)
{
    PWM00_MAP = 0X00;   //映射到·PA0
	PWM01_MAP = 0X01;   //映射到·PA1
	PWM10_MAP = 0X02;   //映射到·PA2
	PWM11_MAP = 0X03;   //映射到·PA3
	PWM20_MAP = 0X04;   //映射到·PA4
	PWM21_MAP = 0X05;   //映射到·PA5

	T3CLKEN = 1;        //打开timer3时钟
	PWM2CON0 = 0XFF;    //使能PWM2-PWM5,使能PWM2-PWM5引脚映射功能
	PWM2CON1 = 0X00;    //PWM2-PWM5正向输出
	CCPCLKEN = 1;       //使能CCP

	PR3H = 0X0F;        //周期4ms
	PR3L = 0XA0;
	TMR3H = 0X00;
	TMR3L = 0X00;
	PWM2H = 0X04;       //占空比30.8%
	PWM2L = 0XD0;
	PWM3H = 0X07;       //占空比50%
	PWM3L = 0XD0;
	PWM4H = 0X09;       //占空比62.8%
	PWM4L = 0XD0;


    PMS = 0X80;        //三组全互补模式
	PXC = 0X80;        //使能TIMER3控制，PWM2.3.4映射到三组
	DTC = 0X00;        //无死区
	POLS = 0X00;       //同向输出
	PME = 0X3F;        //使能映射

	//TRISC2 = 1;
	//PWM1CON0 = 0X00;

	T3CON = 0X87;      //使能timer3  预分频16    后分频1



}



