国产精品无码一区二区三区A片_无码狠狠躁久久久久久久91_国产精品久久久久久久_国产99九九久久无码熟妇_国产人妻精品久久久久野外_久久夜色精品国产欧美乱极品_91精品国产色综合久久不卡98口_精品人妻系列无码人妻免费视频

技術(shù)熱線: 4007-888-234
設(shè)計(jì)開發(fā)

專注差異化嵌入式產(chǎn)品解決方案 給智能產(chǎn)品定制注入靈魂給予生命

開發(fā)工具

提供開發(fā)工具、應(yīng)用測(cè)試 完善的開發(fā)代碼案例庫(kù)分享

技術(shù)支持

從全面的產(chǎn)品導(dǎo)入到強(qiáng)大技術(shù)支援服務(wù) 全程貼心伴隨服務(wù),創(chuàng)造無(wú)限潛能!

新品推廣

提供新的芯片及解決方案,提升客戶產(chǎn)品競(jìng)爭(zhēng)力

新聞中心

提供最新的單片機(jī)資訊,行業(yè)消息以及公司新聞動(dòng)態(tài)

CCS初學(xué)流水燈程序+(Proteus)仿真

更新時(shí)間: 2019-03-26
閱讀量:4265

/////////////////////////////////////////////////////////////////////////
////                             UTA_1.C                             ////
//// This program shows how to use the pins on a PIC16F630 for       ////
//// general I/O.When run, the program will run up and down the LEDs.////
////                                                                 ////
/////////////////////////////////////////////////////////////////////////
////               Copyright (C) 2006 www.czuta.com                  ////
//// Editor:   UltraEdit-32                                          ////
//// Compiler: CCS PCM C Compiler, Version 3.187                     ////

//// Programer:SUPERPRO 280                                          ////
//// Author:   LiuJian(cz_utb@126.com)                               ////
//// Data:     2006-02-08                                            ////
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
////                        Release Note                             ////
////  ROM used: 135 (13%)                                            ////
////  RAM used: 2 (3%) at main() level          ////

////            3 (5%) worst case                                    ////
/////////////////////////////////////////////////////////////////////////
//---------------------------------------------------------------------//
// hardware.h
#ifndef _HARDWARE_H_
#define _HARDWARE_H_
#include <16F630.h>
/*Porta Define:
    RA0:     NOUSE    X
    RA1:     NOUSE    X
    RA2:     NOUSE    X
    RA3:     NOUSE    X
    RA4:     NOUSE    X
    RA5:     NOUSE    X
*/
#define TRISA_INIT     0x00
#define PORTA_INIT     0x00

/*Portc Define:
    RC0:     LED_1    OUT
    RC1:     LED_2    OUT
    RC2:     LED_3    OUT
    RC3:     LED_4    OUT
    RC4:     LED_5    OUT
    RC5:     NOUSE    X
*/
#define TRISC_INIT     0x00
#define PORTC_INIT     0x00

 

//Out Pin Marco Define
#define SET_LED_1  PIN_C0
#define SET_LED_2  PIN_C1
#define SET_LED_3  PIN_C2
#define SET_LED_4  PIN_C3
#define SET_LED_5  PIN_C4
// UTA_1.h
#define CYCLE_DEF  250      // CYCLE=1ms*CYCLE_DEF
#endif

//---------------------------------------------------------------------//
#fuses INTRC_IO,NOWDT,NOMCLR,NOPROTECT,NOCPD,BROWNOUT,PUT
#use delay(clock=4000000)
#use fast_io(A)
#use fast_io(C)
//---------------------------------------------------------------------//
void sfrinit(void)
{
//option
disable_interrupts(GLOBAL);
    set_tris_a(TRISA_INIT);
    output_a(PORTA_INIT);
    set_tris_c(TRISC_INIT);
    output_c(PORTC_INIT);
    setup_comparator(NC_NC_NC_NC);
}
//---------------------------------------------------------------------//

void userinit(void)
{
output_c(255);
delay_ms (CYCLE_DEF);
output_c(0);
delay_ms (CYCLE_DEF);

 

}
//---------------------------------------------------------------------//
void ledshow_forward (void)

{
output_low (SET_LED_5);
    output_high (SET_LED_1);
    delay_ms (CYCLE_DEF);
    output_low (SET_LED_1);
    output_high (SET_LED_2);
    delay_ms (CYCLE_DEF);
    output_low (SET_LED_2);
    output_high (SET_LED_3);
    delay_ms (CYCLE_DEF);
    output_low (SET_LED_3);
    output_high (SET_LED_4);
    delay_ms (CYCLE_DEF);
    output_low (SET_LED_4);
    output_high (SET_LED_5);
    delay_ms (CYCLE_DEF);
}
//---------------------------------------------------------------------//
void ledshow_backward (void)
{
    output_low (SET_LED_1);
    output_high (SET_LED_5);
    delay_ms (CYCLE_DEF);

{
output_low (SET_LED_5);
    output_high (SET_LED_1);
    delay_ms (CYCLE_DEF);
    output_low (SET_LED_1);
    output_high (SET_LED_2);
    delay_ms (CYCLE_DEF);
    output_low (SET_LED_2);
    output_high (SET_LED_3);
    delay_ms (CYCLE_DEF);
    output_low (SET_LED_3);
    output_high (SET_LED_4);
    delay_ms (CYCLE_DEF);
    output_low (SET_LED_4);
    output_high (SET_LED_5);
    delay_ms (CYCLE_DEF);
}
//---------------------------------------------------------------------//
void ledshow_backward (void)
{
    output_low (SET_LED_1);
    output_high (SET_LED_5);
    delay_ms (CYCLE_DEF);

  userinit();
    while(1)
    {
     ledshow_forward();
     ledshow_backward();
    }
}

 

//---------------------------------------------------------------------//