testauto.c

来自「这是一个基于nec78f8024的led驱动程序」· C语言 代码 · 共 80 行

C
80
字号
/*
*******************************************************************************
**  COPYRIGHT (C) NEC Electronics Corporation 2008
**  NEC ELECTRONICS CONFIDENTIAL AND PROPRIETARY
**  All rights reserved by NEC Electronics Corporation.
**  Use of copyright notice does not evidence publication.
**
**  Filename :	AUTO.c
**  Abstract :	This file implements the control function of time for 
**                                                         variable dimming.
**
**  Device :	uPD78F8024
**
**  Compiler :	NEC/CC78K0
**
*******************************************************************************
*/
#pragma interrupt	INTTM000	interval_interrupt
/*
*******************************************************************************
**  Include files
*******************************************************************************
*/
#include "testmacrodriver.h"
#include "testAUTO.h"

/*
*******************************************************************************
**  Function Prototypes
*******************************************************************************
*/
__interrupt void  interval_interrupt( void );

/*
*******************************************************************************
**  External Variable Difinition
*******************************************************************************
*/
short g_shTimeRemain[4];					/* to store the remainder time until changing brightness */
short g_shListReadPoint[4];					/* to store element number that brightness setting list  */
unsigned char	g_ucCyclic;					/* to store presence of cyclic lighting setting  */
unsigned char	g_ucListEnable[4] = {TRUE, TRUE, TRUE, TRUE};		/* to store effective/invalidity of brightness setting list */
unsigned char 	g_ucChangeTrigger[4] = {FALSE, FALSE, FALSE, FALSE};	/* to presence of necessity for reading from brightness setting list */

/*
**-----------------------------------------------------------------------------
**
**  function name:
**  	interval_interrupt
**
**  Parameters:
**  	None
**
**  Returns:
**  	None
**
**-----------------------------------------------------------------------------
*/ 
__interrupt void  interval_interrupt( void )
{
	/*****************************************************/
	/*** This interrupt hundler is called of each 10ms ***/
	/*****************************************************/

	unsigned char ucLoopCount; /* for loop control */

	for (ucLoopCount=0; ucLoopCount<4; ucLoopCount++) {
		/* decrease the remainder time to changing brightness */
		g_shTimeRemain[ucLoopCount]--;
		/* when the remainder time to changing brightness disappears */
		if(g_shTimeRemain[ucLoopCount] == 0) {
			/* increase the element number that brightness setting list */
			g_shListReadPoint[ucLoopCount]++;
			/* It is necessary to read from the brightness setting list  */
			g_ucChangeTrigger[ucLoopCount] = TRUE;
		}
	}
}

⌨️ 快捷键说明

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