📄 sci_2407.c
字号:
#include "f2407_c.h"
#define LED port1000
volatile ioport unsigned int port1000;/*LED*/
extern void delay(unsigned int period);
unsigned int indata;
/****************************** MAIN ROUTINE ***************************/
void main(void)
{
unsigned int t_sci;
*WDCR = 0x00E8;
*SCSR1 = 0x00fd;
*SCSR2 = (*SCSR2 | 0x000B) & 0x000F;
WSGR = 0x01c0;
*MCRA = 0x0003; /* group A pins */
*MCRB = 0xFEDC; /* group B pins */
*MCRC = 0x0000; /* group C pins */
asm(" setc INTM");
*IMR = 0x0000; /* clear the IMR register */
*IFR = 0xffff; /* clear any pending core interrupts */
*WDKEY =0x5555;
*WDKEY =0xaaaa;
*PCDATDIR=*PCDATDIR|0x2000; /*PC5 is output*/
LED=0x00ff;
/***********************************************************************
/*SCI test(LOOPBACK)
/*First,short connect DB9,2and3 pin
/*JP8(1-2),JP9(1-2),JP23(2-3),JP25(2-3),JP15(1-2),JP16(1-2),JP12(1-2),JP13(1-2)
/*if SCI failed , LED3 flash
/***********************************************************************/
LED=0xfffb;
t_sci=test_sci();
if(t_sci==0)LEDflash(0x00fb);
/********************************************************************
/*if all tests passed , 8 LEDs flash at rate of about 2Hz
/*******************************************************************/
while(1)
{
LED=0xffff;
delay(1000);
LED=0x0000;
delay(1000);
}
} /* end of main() */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -