8 led interface.c

来自「PIC16F877 Example code for 8LED interfac」· C语言 代码 · 共 39 行

C
39
字号
	
// Program to ON the LED on the port Pin

 

#include <16c84.h> 

#USE DELAY( CLOCK=4000000 ) 

#FUSES XT,NOWDT,NOPROTECT,NOPUT 


#byte port_b=6 


 main(){

 byte cnt; value;

   set_tris_b(0); 
   port_b = 0; 
   value = 0x01;

    while( TRUE )
    { 
     cnt = 0;

   while ( cnt<8 )
      { 
       port_b = value;
         DELAY_MS(1000);
          value = value << 1; 
            cnt++;
           }
        }
     }


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?