STC TIM0 中断输出

来源:互联网 发布:app软件页面模板源码 编辑:程序博客网 时间:2024/06/05 15:35
         #include "reg51.h"
         unsigned int count=0; 
         sbit p1_6=P1^6;
         sbit p1_7=P1^7;
         sfr AUXR=0x8e;                    //Auxiliary register
         void timer0() interrupt 1
         { 
          count=count+1;
          TH0=0X53;
          TL0=0X32;
          if(count==500)
  p1_6=!p1_6,
 count=0;
         }  
         void main()
         { 
AUXR=0X80;   //STC系列的1T 设置
         TMOD=0X01;
         TH0=0X53;
         TL0=0X32;
         EA=1;
         ET0=1;
         TR0=1;
         while(1)
         {;}
         }
0 0
原创粉丝点击