📄 main.c
字号:
/** THIS SAMPLE CODE IS PROVIDED AS IS. FUJITSU MICROELECTRONICS **/
/** ACCEPTS NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR OMMISSIONS **/
/****************************************************************************
/* Date : 2002/11/01
* PROJECT: CAN
* Version: No.2
* Program: standard frame format
bit rate : 500kbps
* TX0 : Buffer5(ID=300H,DTR5=A0A0H)
RX0 : Buffer0(ID=100H)
Buffer1(ID=200H)
* CPU : FMC-16LX(MB90F543G)
* Vcc,f : Vcc=5.0V,f=16MHz(4MHz x PLL4)
* Sorce : ffmc16.c,start905m.asm,pll.c
* Include: f16f.h,f16fs.h,f16l.h,f16ls.h,f16lx.h,f16lxr.h,f16lxs.h,
* ffmc16.h,mb90540.h,
* Input : RX0 (CAN0):(QFP:74,LQFP:72)
* RX1 (CAN1):(QFP:76,LQFP:74)
* Output : TX0 (CAN0):(QFP:73,LQFP:71)
* TX1 (CAN1):(QFP:75,LQFP:73)
*****************************************************************************/
#include "_ffmc16.h"
#include "extern.h"
/*****************************************************************************/
/* Main Routine */
/*****************************************************************************/
void main(void)
{
unsigned int fail=0;
IO_CKSCR.byte= 0xcc; /* main */
__wait_nop();
__wait_nop();
__wait_nop();
__wait_nop();
__wait_nop();
__wait_nop();
__wait_nop();
__wait_nop();
IO_CKSCR.byte= 0x0B; /* PLL4 */
while(IO_CKSCR.bit.MCM == 1 )
{
if(fail<0x1000) /* PLL stabilization time is max 2^12/fch. */
{
fail++; /* You really had better have Fail-safe software in this area for avoiding Software-stack. */
}
else break;
}
__set_il(7);
__EI();
IO_PDR4.byte = 0x0ff;
IO_DDR4.byte = 0x0ff;
// init_CAN0(); /*CAN0 initialize */
init_CAN1(); /*CAN1 initialize */
init_RELOAD0(); /*Reload Timer initialize */
init_RELOAD1(); /*Reload Timer initialize */
while(1)
{
error_judge_CAN0();
error_judge_CAN1();
}
}
/* Vector Table */
#pragma section INTVECT,attr=CODE
#pragma intvect _start 0x8 0 /* Reset Vector */
#pragma intvect can0_rx_int 0xb /* CAN0 RX Vector */
#pragma intvect can0_tx_int 0xc /* CAN0 TX Vector */
#pragma intvect can1_rx_int 0xd /* CAN1 RX Vector */
#pragma intvect can1_tx_int 0xe /* CAN1 TX Vector */
#pragma intvect timer0_int 0x11 /* 16bit Reload Timer0 Vector*/
#pragma intvect timer1_int 0x24 /* 16bit Reload Timer1 Vector*/
#pragma defvect dummy /* dummy Vector */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -