📄 f_8_5_ledflash.c
字号:
#include "config.h"
// a subroutine that implements a delay via loops
// Note that the compile option used will alter this delay!
// Always use -O compile option
void a_delay(void){
unsigned int i,k;
// change count values to alter delay
for (k=1800; --k;) {
for(i = 200 ; --i ;);
}
}
// just flash LED on port RB1
// use this to test if PIC board is alive
void main(void)
{
TRISB1 = 0; // set RB1 as output
RB1 = 0; // turn RB1 off
while(1) { // note infinite loop, all PIC programs should
// be an infinite loop of some kind. Why? If the
// loop exited, what would the PIC do?
a_delay(); // a subroutine that implements a delay via loops
RB1 = 1; // turn on RB1
a_delay();
RB1 = 0; // turn off RB1
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -