⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tid1_fixcyc.c

📁 瑞萨CAN通讯单片机程序
💻 C
字号:
/*""FILE COMMENT""*****************************************************
 *	M32R C Programming		Rev. 1.00
 *		< Sample Program for TID1 fixed cycle count mode >
 *
 *	Copyright (c) 2003 Renesas Technology Corporation
 *			   And Renesas Solutions Corporation
 *			   All Rights Reserved
 *********************************************************************/

/************************************************************************/
/*		Include file						*/
/************************************************************************/

#include		"..\inc\sfr32170_pragma.h"

/************************************************************************/
/*		Function prototype declaration				*/
/************************************************************************/

	void		TID1_FixCyc_init(void);		/* Initialize TID1 fixed cycle count mode */
	void		TID1_FixCycInt(void);		/* Process TID1 fixed cycle interrupt (user processing) */

/************************************************************************/
/*		Define macro						*/
/************************************************************************/

/*** Fixed cycle (TID1) ***/

							/* 0123 4567	*/
#define	TID1_FixCyc		(unsigned char)0x11	/* 0001 0001B	*/
							/*  |||  | +-- PRS4 count start			*/
							/*  |||  +---- Enable output to TOD1 invalid	*/
							/*  ||+------- TID1 count start			*/
							/*  ++-------- TID1 fixed cycle count mode	*/

#define	TID1_ILevel		(unsigned char)0	/* Set TID1 output IRQ priority level(interrupt disabled)*/

#define	TID1_Cycle		(unsigned short)5000 - 1	/* TID1 interrupt period */

/*""FUNC COMMENT""*******************************************************
 * Function name: TID1_FixCyc_init()
 *-----------------------------------------------------------------------
 * Description	: Initial settings for generating fixed cycle interrupt while driving TID1 in fixed cycle mode
 * 		: - While driving TID1 in fixed cycle mode, generate an interrupt at fixed intervals
 *-----------------------------------------------------------------------
 * Argument	: -
 *-----------------------------------------------------------------------
 * Returns	: -
 *-----------------------------------------------------------------------
 * Notes	: The prescaler, etc. are set separately from the above
 * 		: Must be executed while interrupts are disabled
 *""FUNC COMMENT END""***************************************************/
void	TID1_FixCyc_init()
{
/*** Setting fixed cycle count mode (TID1) ***/

	ITID1CR = TID1_ILevel;					/* Set TID1 output interrupt priority level */

	TID1RL = TID1_Cycle;					/* Set initial value in TID1 reload register */

	TID1PRS4EN = TID1_FixCyc;				/* Set TID1 fixed cycle count mode and enable count */
}

#if 0
/*""FUNC COMMENT""*******************************************************
 * Function name: TID1_FixCycInt()
 *-----------------------------------------------------------------------
 * Description	: Process fixed cycle interrupt
 *-----------------------------------------------------------------------
 * Argument	: -
 *-----------------------------------------------------------------------
 * Returns	: -
 *-----------------------------------------------------------------------
 * Notes	: -
 *""FUNC COMMENT END""***************************************************/
void	TID1_FixCycInt()
{
}
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -