• 会员登录 | 会员注册 | 忘记密码 | 地图 | 博客 | 问答 | 搜索 | 在线工具 | 下载中心
  • 您的位置:  首页 >> 音响技术 >> 单片机 >> 小区档车杆 蓝牙卡:433M收发模块一套+STC15F104+SOP8板+旧手机电池,全完事8元钱左右!
    小区档车杆 蓝牙卡:433M收发模块一套+STC15F104+SOP8板+旧手机电池,全完事8元钱左右!
    2019年01月25日 点击: 编辑: ztb096001

    [backcolor=#ffffff]单片机源程序如下:[/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]//        我刚会点亮单个发光管,其它什么都不会,大家不要笑我的代码啊,哈哈哈哈            [/backcolor]
    [backcolor=#ffffff]/*   [/backcolor]
    [backcolor=#ffffff]新手参考测试 11.0592MHZ   STC15F104W STC15W204S STC15F2K61S2(仅单个芯片+pcb裸板,无任何其它电子原件!)[/backcolor]
    [backcolor=#ffffff]日期:20190124 ver 0.001  test OK[/backcolor]
    [backcolor=#ffffff]STC-ISP V6.860 设置11.0592MHZ后,是11.0492MHZ--11.0692MHZ 之间,有误差小于3us左右[/backcolor]
    [backcolor=#ffffff]*/[/backcolor]
    [backcolor=#ffffff]#include <intrins.h> [/backcolor]
    [backcolor=#ffffff]#include<STC15F2K60S2.H>[/backcolor]
    [backcolor=#ffffff]                                //sbit ZTB30=P3^0;[/backcolor]
    [backcolor=#ffffff]                                //sbit ZTB31=P3^1;[/backcolor]
    [backcolor=#ffffff]                                //sbit ZTB32=P3^2;[/backcolor]
    [backcolor=#ffffff]                                //sbit ZTB33=P3^3;                 [/backcolor]
    [backcolor=#ffffff]sbit ZTB34=P3^4;                  //  批量    STC15F104 发射脚[/backcolor]
    [backcolor=#ffffff]sbit ZTB54=P5^4;                 //  开发板  st15wc204 发射脚[/backcolor]
    [backcolor=#ffffff]sbit ZTB55=P5^5;                //  开发板  st15wc204 发射脚[/backcolor]
    [backcolor=#ffffff]unsigned int  K=1,i;                //  k=0,K=1, 433MHZ发射板 正负逻辑,原装0  模块1[/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]void HH() [/backcolor]
    [backcolor=#ffffff]         {[/backcolor]
    [backcolor=#ffffff]         ZTB54=K;ZTB34=K;                         //高电屏[/backcolor]
    [backcolor=#ffffff]         }  [/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]void LL()[/backcolor]
    [backcolor=#ffffff]         {[/backcolor]
    [backcolor=#ffffff]         ZTB54=!K;ZTB34=!K;                       //低电屏[/backcolor]
    [backcolor=#ffffff]         }[/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]void A1()                                           //高低电屏逻辑   A1 100us 100us[/backcolor]
    [backcolor=#ffffff]         {        [/backcolor]
    [backcolor=#ffffff]         HH();for(i=65;i>0;i--);[/backcolor]
    [backcolor=#ffffff]         LL();for(i=65;i>0;i--);[/backcolor]
    [backcolor=#ffffff]         }[/backcolor]
    [backcolor=#ffffff]                          [/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]void B1()                                          //高低电屏逻辑   B1 200us 200us[/backcolor]
    [backcolor=#ffffff]        {        [/backcolor]
    [backcolor=#ffffff]        HH();for(i=130;i>0;i--);[/backcolor]
    [backcolor=#ffffff]        LL();for(i=130;i>0;i--);[/backcolor]
    [backcolor=#ffffff]        } [/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]void C1()                                          //高低电屏逻辑    C1 400us  400us[/backcolor]
    [backcolor=#ffffff]       {        [/backcolor]
    [backcolor=#ffffff]         HH();for(i=260;i>0;i--);[/backcolor]
    [backcolor=#ffffff]         LL();for(i=260;i>0;i--); [/backcolor]
    [backcolor=#ffffff]       } [/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]void D1()                                          //高低电屏逻辑  D1  800us  800us[/backcolor]
    [backcolor=#ffffff]       {         [/backcolor]
    [backcolor=#ffffff]         HH();for(i=520;i>0;i--);[/backcolor]
    [backcolor=#ffffff]         LL();for(i=520;i>0;i--);[/backcolor]
    [backcolor=#ffffff]       }[/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]void  T3()[/backcolor]
    [backcolor=#ffffff]        {[/backcolor]
    [backcolor=#ffffff]        HH(); for(i=65535;i>0;i--);              //  100.572ms      11.0592  mhz        [/backcolor]
    [backcolor=#ffffff]        LL(); for(i=65535;i>0;i--);                 //  100.572ms            11.0592  mhz        [/backcolor]
    [backcolor=#ffffff]        }[/backcolor]
    [backcolor=#ffffff]void T4()[/backcolor]
    [backcolor=#ffffff]       {          [/backcolor]
    [backcolor=#ffffff]        HH(); for(i=65162;i>0;i--);              //  100ms             11.0592  mhz                 [/backcolor]
    [backcolor=#ffffff]        LL(); for(i=65109;i>0;i--);                     //  100ms           11.0592   mhz[/backcolor]
    [backcolor=#ffffff]       }                                                                    [/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]void main()[/backcolor]
    [backcolor=#ffffff]{ [/backcolor]
    [backcolor=#ffffff]ZTB55=0;                         //与GND短接,当电源地线用 ,(不想跳过此芯片脚:ant、 vcc、 p55+gnd   只焊并排三个脚)  [/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]T3();                              //测试一下高低电屏平均误差时间<3us,[/backcolor]
    [backcolor=#ffffff]A1();B1();C1();D1();                            [/backcolor]
    [backcolor=#ffffff]A1();A1();A1();A1();A1();                    [/backcolor]
    [backcolor=#ffffff]B1();B1();B1();B1();B1();[/backcolor]
    [backcolor=#ffffff]C1();C1();C1();C1();C1();[/backcolor]
    [backcolor=#ffffff]D1();D1();D1();D1();D1();[/backcolor]
    [backcolor=#ffffff]T4();[/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]}[/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]======================================================================================[/backcolor]
    [backcolor=#ffffff]======================================================================================                 [/backcolor]
    [backcolor=#ffffff]                      [/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]/*   某小区档车杆 蓝牙卡 发射码 "ABCD" 循环 临时测试 (误差<3us)[/backcolor]
    [backcolor=#ffffff]                        STC15F104W STC15W204S STC15F2K61S2[/backcolor]
    [backcolor=#ffffff]             制作日期:20190114 ver 0.004  test[/backcolor]
    [backcolor=#ffffff]淘宝 433收发模块一套+STC15F104+SOP8板+旧手机电池,全完事8元钱左右写好程序接上电就成了![/backcolor]
    [backcolor=#ffffff]*/[/backcolor]
    [backcolor=#ffffff]#include <intrins.h> [/backcolor]
    [backcolor=#ffffff]#include<STC15F2K60S2.H>                 [/backcolor]
    [backcolor=#ffffff]sbit ZTB=P3^4;                                          //  批量    STC15F104 发射脚[/backcolor]
    [backcolor=#ffffff]sbit ZTB54=P5^4;                                   //  开发板  st15wc204 发射脚[/backcolor]
    [backcolor=#ffffff]sbit ZTB55=P5^5;                //  开发板  st15wc204 发射脚[/backcolor]
    [backcolor=#ffffff]unsigned int  K=0,i;                //  k=0,K=1, 433MHZ发射板 正负逻辑,原装1  模块0[/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]void PP() [/backcolor]
    [backcolor=#ffffff]         {[/backcolor]
    [backcolor=#ffffff]             ZTB54=K;ZTB=K;ZTB55=K ;[/backcolor]
    [backcolor=#ffffff]         }  [/backcolor]
    [backcolor=#ffffff]                                            [/backcolor]
    [backcolor=#ffffff]void BB()[/backcolor]
    [backcolor=#ffffff]     {[/backcolor]
    [backcolor=#ffffff]         ZTB54=!K;ZTB=!K;ZTB55=!K;[/backcolor]
    [backcolor=#ffffff]     }[/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]void A1()                                           //高低电屏逻辑   A 01 300us 300us[/backcolor]
    [backcolor=#ffffff]         {        [/backcolor]
    [backcolor=#ffffff]         PP();for(i=188;i>0;i--);[/backcolor]
    [backcolor=#ffffff]         BB();for(i=199;i>0;i--);[/backcolor]
    [backcolor=#ffffff]         PP();[/backcolor]
    [backcolor=#ffffff]         }[/backcolor]
    [backcolor=#ffffff]                          [/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]void B1()                                          //高低低电屏逻辑   B 011 300us 700us[/backcolor]
    [backcolor=#ffffff]     {        [/backcolor]
    [backcolor=#ffffff]        PP();for(i=188;i>0;i--);[/backcolor]
    [backcolor=#ffffff]        BB();for(i=458;i>0;i--);[/backcolor]
    [backcolor=#ffffff]        PP();[/backcolor]
    [backcolor=#ffffff]         } [/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]void C1()                                          //高高低电屏逻辑    C 001 700us  300us[/backcolor]
    [backcolor=#ffffff]     {        [/backcolor]
    [backcolor=#ffffff]         PP();for(i=455;i>0;i--);[/backcolor]
    [backcolor=#ffffff]         BB();for(i=199;i>0;i--);[/backcolor]
    [backcolor=#ffffff]         PP();[/backcolor]
    [backcolor=#ffffff]     } [/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]void D1()                                          //高高低低电屏逻辑  D 0011  700us  700us[/backcolor]
    [backcolor=#ffffff]     {         PP();for(i=455;i>0;i--);[/backcolor]
    [backcolor=#ffffff]         BB();for(i=458;i>0;i--);[/backcolor]
    [backcolor=#ffffff]                PP();[/backcolor]
    [backcolor=#ffffff]          }[/backcolor]
    [backcolor=#ffffff]void  T3()[/backcolor]
    [backcolor=#ffffff]         {[/backcolor]
    [backcolor=#ffffff]    PP();       for(i=65000;i>0;i--);[/backcolor]
    [backcolor=#ffffff]        A1();       for(i=66;i>0;i--); [/backcolor]
    [backcolor=#ffffff]        PP();                for(i=31;i>0;i--); [/backcolor]
    [backcolor=#ffffff]        A1();       for(i=65;i>0;i--);  [/backcolor]
    [backcolor=#ffffff]        PP();                for(i=31;i>0;i--); [/backcolor]
    [backcolor=#ffffff]        B1();            for(i=136;i>0;i--);[/backcolor]
    [backcolor=#ffffff]        PP();            for(i=11400;i>0;i--);[/backcolor]
    [backcolor=#ffffff]        A1();[/backcolor]
    [backcolor=#ffffff]        PP();            for(i=8413;i>0;i--);[/backcolor]
    [backcolor=#ffffff]         [/backcolor]
    [backcolor=#ffffff]        }[/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]void T4()[/backcolor]
    [backcolor=#ffffff]  {          [/backcolor]
    [backcolor=#ffffff]            PP();  for(i=1260;i>0;i--); [/backcolor]
    [backcolor=#ffffff]            BB();  for(i=302;i>0;i--); [/backcolor]
    [backcolor=#ffffff]            PP();[/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]            PP();  for(i=1260;i>0;i--); [/backcolor]
    [backcolor=#ffffff]            BB();  for(i=302;i>0;i--); [/backcolor]
    [backcolor=#ffffff]            PP();[/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]            PP();  for(i=1260;i>0;i--); [/backcolor]
    [backcolor=#ffffff]            BB();  for(i=302;i>0;i--); [/backcolor]
    [backcolor=#ffffff]            PP();[/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]            PP();  for(i=1260;i>0;i--); [/backcolor]
    [backcolor=#ffffff]            BB();  for(i=302;i>0;i--); [/backcolor]
    [backcolor=#ffffff]            PP();[/backcolor]
    [backcolor=#ffffff]          [/backcolor]
    [backcolor=#ffffff]  }[/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]void main()[/backcolor]
    [backcolor=#ffffff]{ [/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]T3();[/backcolor]
    [backcolor=#ffffff]C1();A1();A1();B1();[/backcolor]
    [backcolor=#ffffff]C1();A1();C1();B1();[/backcolor]
    [backcolor=#ffffff]C1();A1();C1();A1();[/backcolor]
    [backcolor=#ffffff]A1();A1();A1();C1();[/backcolor]
    [backcolor=#ffffff]C1();A1();A1();C1();[/backcolor]
    [backcolor=#ffffff]C1();D1();D1();C1();[/backcolor]
    [backcolor=#ffffff]C1();C1();B1();A1();[/backcolor]
    [backcolor=#ffffff]A1();B1();C1();C1();[/backcolor]
    [backcolor=#ffffff]A1();[/backcolor]
    [backcolor=#ffffff]T4();[/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]T3();[/backcolor]
    [backcolor=#ffffff]A1();B1();A1();B1();[/backcolor]
    [backcolor=#ffffff]A1();B1();C1();B1();[/backcolor]
    [backcolor=#ffffff]A1();B1();C1();A1();[/backcolor]
    [backcolor=#ffffff]C1();B1();A1();C1();[/backcolor]
    [backcolor=#ffffff]A1();B1();A1();C1();[/backcolor]
    [backcolor=#ffffff]A1();C1();D1();C1();[/backcolor]
    [backcolor=#ffffff]A1();D1();B1();A1();[/backcolor]
    [backcolor=#ffffff]C1();A1();C1();C1();[/backcolor]
    [backcolor=#ffffff]C1();[/backcolor]
    [backcolor=#ffffff]T4();[/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]T3();[/backcolor]
    [backcolor=#ffffff]D1();A1();A1();D1();[/backcolor]
    [backcolor=#ffffff]D1();A1();C1();D1();[/backcolor]
    [backcolor=#ffffff]D1();A1();C1();C1();[/backcolor]
    [backcolor=#ffffff]B1();A1();A1();A1();[/backcolor]
    [backcolor=#ffffff]D1();A1();A1();A1();[/backcolor]
    [backcolor=#ffffff]D1();D1();D1();A1();[/backcolor]
    [backcolor=#ffffff]D1();C1();B1();C1();[/backcolor]
    [backcolor=#ffffff]B1();B1();C1();A1();[/backcolor]
    [backcolor=#ffffff]A1();[/backcolor]
    [backcolor=#ffffff]T4();[/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]T3();[/backcolor]
    [backcolor=#ffffff]A1();C1();A1();A1();[/backcolor]
    [backcolor=#ffffff]A1();C1();C1();A1();[/backcolor]
    [backcolor=#ffffff]A1();C1();C1();B1();[/backcolor]
    [backcolor=#ffffff]C1();B1();D1();A1();[/backcolor]
    [backcolor=#ffffff]C1();C1();A1();D1();[/backcolor]
    [backcolor=#ffffff]A1();B1();A1();B1();[/backcolor]
    [backcolor=#ffffff]A1();A1();B1();B1();[/backcolor]
    [backcolor=#ffffff]C1();A1();C1();C1();[/backcolor]
    [backcolor=#ffffff]A1();[/backcolor]
    [backcolor=#ffffff]T4();[/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]T3();[/backcolor]
    [backcolor=#ffffff]D1();D1();C1();D1();[/backcolor]
    [backcolor=#ffffff]D1();D1();A1();D1();[/backcolor]
    [backcolor=#ffffff]D1();D1();A1();C1();[/backcolor]
    [backcolor=#ffffff]B1();B1();C1();B1();[/backcolor]
    [backcolor=#ffffff]A1();D1();C1();A1();[/backcolor]
    [backcolor=#ffffff]D1();A1();D1();B1();[/backcolor]
    [backcolor=#ffffff]B1();B1();D1();C1();[/backcolor]
    [backcolor=#ffffff]A1();A1();C1();A1();[/backcolor]
    [backcolor=#ffffff]A1();[/backcolor]
    [backcolor=#ffffff]T4();[/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]T3();[/backcolor]
    [backcolor=#ffffff]B1();C1();C1();D1();[/backcolor]
    [backcolor=#ffffff]B1();C1();A1();D1();[/backcolor]
    [backcolor=#ffffff]B1();C1();A1();C1();[/backcolor]
    [backcolor=#ffffff]D1();A1();C1();B1();[/backcolor]
    [backcolor=#ffffff]C1();C1();C1();A1();[/backcolor]
    [backcolor=#ffffff]B1();B1();D1();B1();[/backcolor]
    [backcolor=#ffffff]D1();A1();D1();C1();[/backcolor]
    [backcolor=#ffffff]C1();B1();C1();A1();[/backcolor]
    [backcolor=#ffffff]C1();[/backcolor]
    [backcolor=#ffffff]T4();[/backcolor]
    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]
    [/backcolor]

    [backcolor=#ffffff]}[/backcolor]
    相关文章
    关于我们 版权声明 站点导航 收藏本站 设为首页