有需要的可以联系我要压缩包,谢谢。
//***************************************************************************
//***** PMC/PMS131 Peocessor Application Example Project *****
//***************************************************************************
// Project Name :: 2-PWM out
// Version :: V0.0
// Module Name ::
// Abstract :: PMC131/PMS131
//
// Environment:
// PADAUK FPPA(TM) IDE Tool Version : 0.63
//
// Revision History:
// Agu. 14, 2014 Raker.Yang Created
// Contact me:
// Tel: 135 1077 9653 ; QQ: 595 142 970
/////////////////////////////////////////////////////////////////////////
// Copyright (C) 2014 by JINRUN Electronic Technology Co. Ltd. All rights reserved.
//=====================================================
#include "extern.h"
word t16_cnt;
word g_word;
byte timer_10ms_cnt;
byte pwm2b_bak;
byte pwm3b_bak;
T16_Base EQU 20000
void t16_init(void)
{
word t16_index;
T16M = 0x2f;
t16_index = 0;
stt16 t16_index;
}
void FPPA0 (void)
{
.ADJUST_IC SYSCLK=IHRC/2, IHRC=16MHz, VDD=5V, Bandgap=Off
PA = 0;
PB = 0;
PAC = 0xff;
timer_10ms_cnt = 0;
PBC = 0xFF;
$ PADIER 0xF9;
$ PBDIER 0xFF;
t16_init();
TM2S = 0B_1_00_00000;
TM3S = 0B_1_00_00000;
pwm2b_bak = 9;
pwm3b_bak = 1;
tm2b = pwm2b_bak;
tm3b = pwm3b_bak;
TM2C = 0B0010_10_1_0; //PB4
TM3C = 0B0010_01_1_0; //PB5
while (1)
{
.wdreset;
ldt16 g_word;
a = (g_word - t16_cnt) >> 8;
if(a < 0x80)
{
// tog VLED1_OUT;
t16_cnt += T16_Base;
if(timer_10ms_cnt < 100)
{
timer_10ms_cnt++;
}
else
{
timer_10ms_cnt = 0;
if(pwm2b_bak < 60)
{
pwm2b_bak++;
pwm3b_bak++;
}
else
{
pwm2b_bak = 9;
pwm3b_bak = 1;
}
tm2b = pwm2b_bak;
tm3b = pwm3b_bak;
}
}
}
} |