flashleds.c
来自「瑞萨M16C编写的模拟PS2主机与标准键盘通讯程序.完整的工程文件,测试可用.」· C语言 代码 · 共 78 行
C
78 行
/***********************************************************************************
FILE NAME FlashLEDs.c
DESCRIPTION Function to Flash the user LEDs for a period of time.
Function will exit if a key is pressed
Copyright : 2005 Renesas Technology Europe Ltd.
Copyright : 2005 Renesas Technology Corporation.
All Rights Reserved
***********************************************************************************/
/***********************************************************************************
Revision History
DD.MM.YYYY OSO-UID Description
23.11.2005 RTE-DDE First Release
***********************************************************************************/
/**********************************************************************************
System Includes
***********************************************************************************/
/**********************************************************************************
User Includes
***********************************************************************************/
/* sfr62p.h provides a structure to access all of the device registers. */
#include "sfr62p.h"
/* rskM16C62Pdef.h provides common defines for widely used items. */
#include "rskM16C62Pdef.h"
#include "FlashLEDs.h"
/**********************************************************************************
Global variables
***********************************************************************************/
/**********************************************************************************
User Program Code
***********************************************************************************/
/**********************************************************************************
Function Name: FlashLEDs
Description: Flashes the user LEDs on the board
Parameters: none
Return value: none
***********************************************************************************/
void FlashLEDs(void)
{
unsigned long ulLed_Delay;
unsigned long ulLEDcount;
LED_PORT_DR = 0x00;
for(ulLed_Delay=0; ulLed_Delay<80000; ulLed_Delay++);
ToggleLEDs();
for(ulLed_Delay=0; ulLed_Delay<80000; ulLed_Delay++);
}
/**********************************************************************************
End of function FlashLEDs
***********************************************************************************/
/**********************************************************************************
Function Name: ToggleLEDs
Description: Toggles the state of the user LEDs on the board.
This function is used in interrupt routines. No static variables.
Parameters: none
Return value: none
***********************************************************************************/
void ToggleLEDs()
{
/* XOR the value of the LED port pins with the mask to invert bits */
LED_PORT_DR ^= LED_BIT;
}
/**********************************************************************************
End of function ToggleLEDs
***********************************************************************************/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?