📄 led.c
字号:
///////////////////////////////////////////////////////////////////////////////
// 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()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -