📄 light1.c
字号:
//*************************************************************************
// LIGHT1.C
// flashes the lights on the demo board
//
//*************************************************************************
//#define PIC_CLK 8
#include <pic.h>
//unsigned char delayus_variable;
//#include "always.h"
#define XTAL_FREQ 8MHZ
#include "delay.h"
#include "delay.c"
void main(void)
{
char count1,count2,temp;
int icount;
PORTA=0x00;
PORTB=0x00;
TRISA=0x00;
TRISB=0x01; //-- all but RXD as output
while(1)
{
//-- Bit shift......
for(count1=0;count1<100;count1++)
{
PORTB = 0x80;
PORTA = 0xFF;
for(count2=0;count2<8;count2++)
{
DelayMs(30);
PORTB=(PORTB>>1);
PORTA=PORTA>>1;
}
DelayMs(100);
}
//-- Binary counter --
temp=0;
for(icount=0;icount<1024;icount++)
{
PORTA=temp;
PORTB=temp ^0xFF;
temp++;
DelayMs(50);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -