📄 u_common.c
字号:
/*****************************************************************************
* File name : common.c
* Module name : Common function module
* Author : Hiromichi Kondo
*----------------------------------------------------------------------------
* $Id: common.c,v 1.1 2003/04/16 06:56:36 9551619 Exp $
*****************************************************************************/
#include "c33l17.h"
#include "u_value.h"
#include "u_macro.h"
#include "u_ram_data.h"
#include "u_rom_data.h"
#include "u_regNikka.h"
/*--- Function Prototype ---------------------------------------------------*/
void timer3_Init(void);
void timer3_Run(void);
void timer3_Stop(void);
void timer3_SetCRxB(unsigned int data);
void panic( int );
/*****************************************************************************
* timer3_Init
*****************************************************************************/
void timer3_Init(void)
{
P16TONx(3) = 1; //timer clock on
PRUNx(3) = 0; //timer stop
PRESETx(3) = 1; //timer reset
CKSLx(3) = 0; //timer input clk
INT_PT16xL(3) = 5; //timer int level
pT16_CRxB(3) = 0x3a20;
pT16_CRxA(3) = 0xffff;
}
/*****************************************************************************
* timer3_Run
*****************************************************************************/
void timer3_Run(void)
{
INT_E16TU(3) = 0;
INT_F16TU(3) = 1;
PRUNx(3) = 0;
PRESETx(3) = 1;
INT_E16TU(3) = 1;
PRUNx(3) = 1;
}
/*****************************************************************************
* timer3_Stop
*****************************************************************************/
void timer3_Stop(void)
{
INT_E16TU(3) = 0;
PRUNx(3) = 0;
INT_F16TU(3) = 1;
PRESETx(3) = 1;
}
/*****************************************************************************
* timer3_SetCmpData
*****************************************************************************/
void timer3_SetCRxB(unsigned int data)
{
pT16_CRxB(3) = data;
pT16_CRxA(3) = 0xffff;
}
/*****************************************************************************
* panic
*****************************************************************************/
void panic( int er_num )
{
int i ;
i = er_num ;
asm("halt");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -