tid0_evcnt.c

来自「瑞萨CAN通讯单片机程序」· C语言 代码 · 共 78 行

C
78
字号
/*""FILE COMMENT""*****************************************************
 *	M32R C Programming		Rev. 1.00
 *		< Sample Program for TID0 event 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		TID0_evcnt( void );			/* Initialize TID0 event count mode */
	void		TID0_evcntInt( void );			/* Process event counter overflow interrupt */

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

/*** Event count (TID0) ***/

							/* 0123 4567	*/
#define	TID0_EvCnt		(unsigned char)0x70	/* 0111 0000B	*/
							/*  |||    +-- don't care			*/
							/*  ||+------- TID0 count start			*/
							/*  ++-------- TID0 event count mode		*/

#define	TID0_ILevel		(unsigned char)7	/* Set TID0 output interrupt priority level(interrupt disabled)*/

/*""FUNC COMMENT""*******************************************************
 * Function name: TID0_evcnt()
 *-----------------------------------------------------------------------
 * Description	: Drive TID0 in event count mode
 * 		: - Drive TID0 in event count mode
 *-----------------------------------------------------------------------
 * Argument	: -
 *-----------------------------------------------------------------------
 * Returns	: -
 *-----------------------------------------------------------------------
 * Notes	: The prescaler, clock bus, etc. are set separately from the above
 * 		: Must be executed while interrupts are disabled
 *""FUNC COMMENT END""***************************************************/
void	TID0_evcnt()
{
/*** Setting TIN24 ***/

	P17MOD |= 0x20;						/* Select P172 for TIN24 */

/*** Setting event count mode (TID0) ***/

	ITID0CR = TID0_ILevel;					/* Set TID0 output interrupt priority level */

	TID0CT = (unsigned short)0x0000;			/* Clear TID0 counter */
	TID0PRS3EN = TID0_EvCnt;				/* Start TID0 event counter count */
}

/*""FUNC COMMENT""*******************************************************
 * Function name: TID0_evcntInt()
 *-----------------------------------------------------------------------
 * Description	: Process event counter overflow interrupt
 *-----------------------------------------------------------------------
 * Argument	: -
 *-----------------------------------------------------------------------
 * Returns	: -
 *-----------------------------------------------------------------------
 * Notes	:
 *""FUNC COMMENT END""***************************************************/
void	TID0_evcntInt()
{
}

⌨️ 快捷键说明

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