/****************撬动月球**************************/
/****************id:共同学习stm8*******************/
/****************qq:774145445**********************/
/****************20231012**ide0.98*****************/
// pms150g_sot23-6
// _______ _______
// in1-|1 pa4 \_/ pa3 6|-out1
// |2 gnd vdd 5|
// feng-key-|3_pa6_______pa5_4|-out2
/**************************************************/
#include "extern.h"
/**************************************************/
in1 bit pa.4;
out1 bit pa.3;
out2 bit pa.5;
key bit pa.6;
feng bit pa.6;
/**************************************************/
void FPPA0 (void)
{
.ADJUST_IC SYSCLK=IHRC/4 // SYSCLK=IHRC/4
$ in1 in,ph;
$ out1 out,low;
$ out2 out,low;
$ key in,ph;
while (1)
{
.delay 10000;
if(in1 ==1){out1 =1; out2 =0;} else{out1 =0; out2 =1;}
if(key ==0)
{
.delay 10000;
if(key ==0)
{
while(1)
{
out1 =0; out2 =0;
$ feng out,low;
}
}
}
}
}
/**************************************************/
/**************************************************/
/**************************************************/
/**************************************************
void Interrupt (void)
{
pushaf;
if (Intrq.T16)
{ // T16 Trig
// User can add code
Intrq.T16 = 0;
//...
}
popaf;
}
/**************************************************/
|