📄 light3.c
字号:
#include "f2407_c.h"
#define LED port40
volatile ioport unsigned int port40;
extern void LEDTEST(unsigned int count);
extern void delay(unsigned int period);
void main(void)
{
*WDCR = 0x00E8;
*SCSR1 = 0x00fd;
*SCSR2 = (*SCSR2 | 0x000B) & 0x000F;
WSGR = 0x01c0;
*MCRA = 0x0003; /* group A pins */
*MCRB = 0xFE1C; /* group B pins */
*MCRC = 0x0000; /* group C pins */
asm(" setc INTM");
*IMR = 0x0000; /* clear the IMR register */
*IFR = 0xffff; /* clear any pending core interrupts */
LEDTest(5);
LED=0x00ff;
}
LEDTest(unsigned int count)
{
unsigned char i,t;
LED=0xffff;
for(;count!=0;count--)
{
for(t=0,i=1;t<8;)
{
LED=~i;
delay(1500);
i=i<<1;
t++;
}
}
}
void delay(unsigned int period)
{
int periodi, periodj;
for(periodi=0; periodi<period; periodi++)
{
for(periodj=0; periodj<period>>1; periodj++);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -