PWMB_CCMR1 = 0X68; // CC5 for pwm output, start pre-load
PWMB_CCER1 = 0X01; // BIT 1 = 0 , BIT0 = 1 ENABLE CC5 HIGH IS WORKING
PWMB_ARR = 8000; // freq = 5000 hz , 5000 = 40000000 / 8000
PWMB_ENO = 0X01; // BIN 0000 0001 , FOR BIT 0 SET 1
PWMB_EGR = 0X01; // ? 0X03
PWMB_BKR = 0X80;
PWMB_IER = 0X01; // ? 0X03
PWMB_CR1 = 0X81;
}
//************************* the main
void main()
{
P1M0 |= 0XFC; // P1^0, P1^1 as high resister model FOR ADC
P1M1 |= 0X03; // M1 = 0, M0 = 0 is quasi-bidirection model
// M1 = 0, M0 = 1 is push pull model
// M1 = 1, M0 = 0 is high resister model
// M1 = 1, M0 = 1 is open drain model
P0M0 |= 0XFF; // P1^0, P1^1 as open drain model, others as pull-push model
P0M1 |= 0X00;
P2M0 |= 0X38; // P1^0, P1^1 as open drain model, others as pull-push model
P2M1 |= 0X38;
P3M0 |= 0XFF; // P3 as pull-push model BIN 1111 1111
P3M1 |= 0X00; //M1 = 0, M0 = 1 is pull-push model