Author Topic: PADAUK_0.91_MINI-C_按键_蜂鸣器  (Read 479 times)

0 Members and 1 Guest are viewing this topic.

Offline suzhiming

  • Contributor
  • Posts: 40
  • Country: cn
PADAUK_0.91_MINI-C_按键_蜂鸣器
« on: June 17, 2021, 03:22:46 pm »
/*****************按键蜂+鸣器**********************/
/*****************qq:774145445*********************/
/*****************快手:共同学习stm8****************/
/*****************IDE:PADAUK_0.91******************/
/*****************20210617*************************/

#include   "extern.h"
/**************************************************/
io_fengmingqi      bit      pa.4;
io_anjian         bit      pa.3;
/**************************************************/
byte      anjian_a1;      //按键次数
byte      anjian_a2;      //按键标志位
byte      anjian_a3;      //按键退出条件
byte      fengmingqi_a1;   //蜂鸣器标志位
byte      fengmingqi_a2;   //蜂鸣器次数
/**************************************************/
void         fengmingqi();      //蜂鸣器
void         anjian();         //按键
/**************************************************/
void   FPPA0 (void)
{
.ADJUST_IC   SYSCLK=IHRC/4      //   SYSCLK=IHRC/4
/**************************************************/
$      io_fengmingqi      out,low;      //输出低
$      io_anjian         in,pull;      //输入上拉
/**************************************************/
anjian_a1      =0;
anjian_a2      =0;
fengmingqi_a1      =0;
fengmingqi_a2      =0;
while (1)
{
anjian();
fengmingqi();
.delay      2000;
}
}
/**************************************************/
void         fengmingqi()      //蜂鸣器
{


}
/**************************************************/
void         anjian()         //按键(释放版)
{
if(anjian_a2==0)      //按键标志是0
   {
   if(io_anjian==0)
   {
   .delay 100;
   if(io_anjian==0)
      {
      anjian_a2      =100;      //按键标志位
      anjian_a3      =100;      //退出标志位
      }
   }
   }


if(anjian_a2>0)      //按键标志是>0
   {
   anjian_a2      --;
   while(io_anjian==0)
      {
      anjian_a3      --;
      .delay 2000;
      if(anjian_a3==0)      //一直按着退出条件
         {
         anjian_a1      ++;      //按键次数
         anjian_a3      =50;
         return;
         }
      }
   anjian_a1      ++;
   anjian_a2      =80;
   anjian_a3      =80;
   }
if(anjian_a3>0)      //定时一定次数结束
   {
   anjian_a3      --;
   if(anjian_a3==0)
      {
      fengmingqi_a1      =1;
      fengmingqi_a2      =anjian_a1;
      anjian_a1         =0;
      anjian_a2         =0;
      }
   }
}
/**************************************************/
/**************************************************/
/**************************************************/
/**************************************************/
 

Offline suzhiming

  • Contributor
  • Posts: 40
  • Country: cn
Re: PADAUK_0.91_MINI-C_按键_蜂鸣器
« Reply #1 on: June 19, 2021, 05:42:22 pm »
/*****************按键蜂+鸣器**********************/
/*****************qq:774145445*********************/
/*****************快手:共同学习stm8****************/
/*****************IDE:PADAUK_0.91******************/
/********完成功能:按键按几次蜂鸣器响几次***********/
/*****************20210617*************************/
//             _______    ______
//           -|vdd    \_/    gnd|-
//    anjian -|pa7  pms150g  pa0|- led
//           -|pa6           pa4|- fengmingqi
//           -|pa5___________pa3|-
#include   "extern.h"
/**************************************************/
io_fengmingqi      bit      pa.4;
io_anjian         bit      pa.7;
io_led            bit      pa.0;
/**************************************************/
byte      anjian_a1;         //按键标志位
byte      anjian_b1;         //按键次数
byte      anjian_c1;         //按键退出条件
byte      anjian_c2;         //按键退出条件

byte      fengmingqi_a1;      //蜂鸣器标志位
byte      fengmingqi_a2;      //蜂鸣器次数
/**************************************************/
void      fengmingqi();      //蜂鸣器
void      anjian();         //按键
void      yanshi();         //延时
void      fengmingqi_yanshi();//蜂鸣器延时
/**************************************************/
void   FPPA0 (void)
{
.ADJUST_IC   SYSCLK=IHRC/4      //   SYSCLK=IHRC/4
/**************************************************/
$      io_fengmingqi      out,low;      //输出低
$      io_anjian         in,pull;      //输入上拉
$      io_led            out,high;      //输出高
/**************************************************/
anjian_a1      =1;      //0不检测,1检测,2计算次数
anjian_b1      =0;
anjian_c1      =0;
anjian_c2      =0;
fengmingqi_a1      =0;
fengmingqi_a2      =0;

while (1)
{
anjian();
fengmingqi();
yanshi();
}
}
/**************************************************/
void         fengmingqi()      //蜂鸣器
{
word      fengmingqi_b1;
if(fengmingqi_a1==1)
{
fengmingqi_a1      =0;
while(fengmingqi_a2--)      //次数
{
fengmingqi_b1      =1000;
while(fengmingqi_b1--)
   {
   fengmingqi_yanshi();
   if(io_fengmingqi){io_fengmingqi=0;}   else{io_fengmingqi=1;}
   }

fengmingqi_b1      =1000;
while(fengmingqi_b1--)
   {
   fengmingqi_yanshi();
   io_fengmingqi      =0;
   }
}


fengmingqi_a2      =0;
anjian_a1         =1;      //开始检测按键
if(io_led){io_led   =0;}   else{io_led   =1;}
}

}
/**************************************************/
void         anjian()         //按键(标志位版带释放)
{
if(anjian_a1==1)      //0不检测,1检测,2计算次数
{
if(io_anjian==0)
   {
   anjian_a1      =2;
   anjian_c1      =200;      //2秒退出条件
   anjian_c2      =200;
   }
}

if(anjian_a1==2)
{
if(anjian_c1 >0)      //退出条件1
   {
   if(io_anjian==0)
      {
      yanshi();
      while(io_anjian==0)
         {
         yanshi();
         anjian_c1      --;
         if(anjian_c1 ==0)      //退出
            {
            anjian_a1      =0;
            fengmingqi_a1   =1;      //打开蜂鸣器
            fengmingqi_a2   =anjian_b1;      //蜂鸣器次数
            anjian_b1      =0;
            }
         }
      anjian_b1      ++;      //按键次数+1
      anjian_c1      =200;      //续2秒时间
      anjian_c2      =200;
      }
   }

if(anjian_c2 >0)      //退出条件2
   {
   anjian_c2      --;
   if(anjian_c2 ==0)
      {
      anjian_a1      =0;
      fengmingqi_a1   =1;      //打开蜂鸣器
      fengmingqi_a2   =anjian_b1;      //蜂鸣器次数
      anjian_b1      =0;
      }
   }

}
}
/**************************************************/
void      yanshi()         //延时
{
.delay      20000;
}
/**************************************************/
void      fengmingqi_yanshi()      //蜂鸣器延时
{
.delay   2500;
}
/**************************************************/
/**************************************************/
 

Offline suzhiming

  • Contributor
  • Posts: 40
  • Country: cn
Re: PADAUK_0.91_MINI-C_按键_蜂鸣器
« Reply #2 on: June 19, 2021, 05:45:17 pm »
ok nono了 :)
 

Offline suzhiming

  • Contributor
  • Posts: 40
  • Country: cn
« Last Edit: June 20, 2021, 07:15:37 am by suzhiming »
 

Offline ebclr

  • Super Contributor
  • ***
  • Posts: 2261
  • Country: 00
Re: PADAUK_0.91_MINI-C_按键_蜂鸣器
« Reply #4 on: June 21, 2021, 09:20:47 am »
I guess I will never understand whats is talking or write on that video, Is coded in a secret code
 

Online gamalot

  • Frequent Contributor
  • **
  • Posts: 636
  • Country: au
  • Correct my English
    • Youtube
Re: PADAUK_0.91_MINI-C_按键_蜂鸣器
« Reply #5 on: June 21, 2021, 10:10:56 am »
For those non-Chinese people who are curious about these codes |O
 
The following users thanked this post: ebclr, ledtester

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 1593
  • Country: us
Re: PADAUK_0.91_MINI-C_按键_蜂鸣器
« Reply #6 on: June 21, 2021, 11:46:15 am »
Quote
...
video4:    https://www.kuaishou.com/short-video/3xmuf32x2z6uybg

The last video shows an SMD soldering technique that's new to me... perhaps it can be called "flick soldering".

Seems to work quite well for those small SOP-8 breakout boards.
« Last Edit: June 21, 2021, 11:48:05 am by ledtester »
 

Offline suzhiming

  • Contributor
  • Posts: 40
  • Country: cn
Re: PADAUK_0.91_MINI-C_按键_蜂鸣器
« Reply #7 on: June 21, 2021, 01:03:20 pm »
Take him as a sign    sign(Tag name)     Don't care too much about it
Pinyin name
仅是一个名称而已
 

Offline suzhiming

  • Contributor
  • Posts: 40
  • Country: cn
Re: PADAUK_0.91_MINI-C_按键_蜂鸣器
« Reply #8 on: June 21, 2021, 03:07:03 pm »
touch key mcu pfc161 essop10
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf