#include "ku.h"
#define MAC 5
//#include "ny8_constant.h"
unsigned int TIME_100MS;
//PWM1 PB3
//PWM2 PB2
void main(void)
{
unsigned int i=1;
unsigned int v=0;
IOSTB=0x00;
TIME0_Init();
while(1)
{
if(TIME_100MS)
{
TIME_100MS = 0;
if(v)
{
i++;
if(i>= 1023)
{
v=0;
}
}
else
{
i--;
if(i<1)
{
v=1;
}
}
PWM1_Init(i);
}
}
}
void isr(void) __interrupt(0) //80 00 02 01
//08 00
{
if(INTFbits.T0IF)
{
TMR0 = MAC;
static unsigned int y;
INTF= (unsigned char)~(0x01);
y++;
if(y >= 10)
{
y = 0;
TIME_100MS=1;
}
}
}