• 大小: 79KB
    文件类型: .7z
    金币: 1
    下载: 0 次
    发布日期: 2021-06-10
  • 语言: 其他
  • 标签: STC  STC15  STC15系列  

资源简介

上次我上传的升级版。这个修改了几个bug,并且优化了程序的运行机制,更加高效。STC15F2K60S2系列学习板1 LED 1602 语音芯片 温度芯片

资源截图

代码片段和文件信息

/***********************************************************
实验名称:LED灯
程序说明:本程序测试了P0口led输出功能
实验平台:stc15单片机开发板v1.0版
日期:2012-05-19
QQ: 259902530
www.stcstudy.com    61mcu.taobao.com  版权所有 
***********************************************************/
#include “STC15F2K.h“
#include 

typedef unsigned char uchar;
typedef unsigned int  uint;

void Delay(uint x);

void main(void) 
{  
   bit Flag = 0;
   P2=0x01;
   P0=0xFE;   
   while(1)
   {
     if(Flag==0)
 {
    P0 = (P0<<1) | 0x01  ;
Delay(100);
if(P0==0x7F) Flag=1;
 }
 else
 {
    P0 = (P0>>1) | 0x80  ;
Delay(100);      
        if(P0==0xFE) Flag=0;
 }
   }
}

void Delay(uint x) //@11.0592MHz   x ms
{
unsigned char i j;
while(x--)
{
  _nop_();
  _nop_();
  _nop_();
  i = 11;
  j = 190;
  do
  {
while (--j);
  } 
  while (--i);
    }
}

评论

共有 条评论