技术热线: 4007-888-234
设计开发

专注差异化嵌入式产品解决方案 给智能产品定制注入灵魂给予生命

开发工具

提供开发工具、应用测试 完善的开发代码案例库分享

技术支持

从全面的产品导入到强大技术支援服务 全程贴心伴随服务,创造无限潜能!

新闻中心

提供最新的单片机资讯,行业消息以及公司新闻动态

CCSC LED2.c程序功能和MCD2demo LED2.asm相似

更新时间: 2019-03-25
阅读量:616

CCSC LED2.c程序功能和MCD2demo LED2.asm相似
///////////////////////////////////////////////////////////////////////////////
// MPLAB IDE V7.11 + CCS C3.18
// LED2 for MCD2-demo
//
// by LW7807@163.com
// 2005/06/16
///////////////////////////////////////////////////////////////////////////////
#include "16F877A.h"                            // PIC16F877 header file
#use delay(clock=4000000)                       // for 4Mhz crystal
#fuses XT, NOWDT, NOPROTECT, NOLVP              // for debug mode

void main(void)
{
        int8 tmp = 0;                           // tmp var

        set_tris_b(0xff);                       // set PORTB for intput
        set_tris_c(0x00);                       // set PORTC for output
        output_c(tmp);                          // PORTC output 0

        while(1){
                while(1 == (input_b()&0x01))    // wait put button
                        {
                        delay_ms(10);
                        }

                output_c(++ tmp);               // output number

                while(0 == (input_b() & 0x01))  // wait free button
                        {
                        delay_ms(10);
                        }
                }//end while(1)
}//end main()