//***************pms132pa0输出1.7mHZ****************/
//***************11位PWM*IHRC16M********************/
//*****************QQ:774145445*********************/
//**************快手:共同学习stm8*******************/
//*****************20201011*************************/
#include "extern.h"
led bit pb.6;
word pwm0_a1,pwm0_a2;
void FPPA0 (void)
{
//.ADJUST_IC SYSCLK=IHRC/4 // SYSCLK=IHRC/4
.ADJUST_IC SYSCLK=IHRC/2, IHRC=17MHz, VDD=5V;
$ pwmg0c enable,reset,pa0,ihrc; //
$ pwmg0s /1/1;
//pwmg0cubh //pwmg0上限高位
//pwmg0cubl //pwmg0上限低位
//pwmg0dth //pwmg0占空比高位
//pwmg0dtl //pwmg0占空比低位
pwm0_a1 =36;//34;
pwm0_a1 <<=4;
pwm0_a2 =18;//17;
pwm0_a2 <<=4;
pwmg0cubl =pwm0_a1$0;
pwmg0cubh =pwm0_a1$1;
pwmg0dtl =pwm0_a2$0; //先写
pwmg0dth =pwm0_a2$1;
$ led out,low;
while (1)
{
led=1;
led=0;
}
}
/*
void Interrupt (void)
{
pushaf;
if (Intrq.T16)
{ // T16 Trig
// User can add code
Intrq.T16 = 0;
//...
}
popaf;
}
*/ |