// pms150g
// ______ ______
// 3.3v-|1-vdd \_/ gnd-8|-gnd
// -|2-pa7 pa0-7|-
// -|3-pa6 pa4-6|-led
// -|4-pa5_____pa3-5|-anjian
#include "extern.h"
led_1 bit pa.0;
led_2 bit pa.4;
anjian_1 bit pa.5;
byte kaiji;
void anjian();
void xianshi();
void FPPA0 (void)
{
.ADJUST_IC SYSCLK=IHRC/4 // SYSCLK=IHRC/4
$ led_1 out,High;
$ led_2 out,High;
$ anjian_1 in,Pull;
kaiji =0;
while (1)
{
xianshi();
anjian();
}
}
/*
void Interrupt (void)
{
pushaf;
if (Intrq.T16)
{ // T16 Trig
// User can add code
Intrq.T16 = 0;
//...
}
popaf;
}
*/
void anjian()
{
if(anjian_1==0)
{
if(kaiji==0){kaiji=1;} else{kaiji=0;}
}
while(anjian_1==0){nop;nop;}
}
void xianshi()
{
if(kaiji==0)
{
led_1 =1;
led_2 =0;
}
if(kaiji==1)
{
led_1 =0;
.delay 4000000;
led_2 =1;
}
}
|