water_fall.c
来自「source code for waterfall project in hit」· C语言 代码 · 共 34 行
C
34 行
#include<pic.h>
void delay(void)
{
unsigned int i;
for(i=0;i<=50000;i++);
{}
}
void main() //WDT_ON
{
unsigned char x,y;
TRISC=0x00; //make PORTC as output
PORTC=0x01;
x=0b00000001; //0x01
y=0b01111111; //0x7f
while(1)
{
delay();
x=x<<1;
PORTC=PORTC|x;
if(PORTC==0b11111111)
{
while(PORTC!=0b00000000)
{
delay();
PORTC=PORTC&y;
y=y>>1;
}
PORTC=0b00000001;
x=0b00000001;
y=0b01111111;
delay();
}}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?