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

📄 led_test.c

📁 COLDFIRE 5282SC的文件
💻 C
字号:
/*
 * File:		led_test.c
 * Purpose:		Test the 4 USER LEDs on the M5282EVB
 *
 * Notes:		
 */

#include "m5282evb.h"
#include "fat.h"
 
/********************************************************************/
void
led_test(void)
{
	uint32 i,j;

	
	RESULTS |= LED_TEST;
	
	/* Set DTOUT0,1,2,3 to act as GPIO */
	MCF5282_GPIO_PTCPAR = 0x0;
	MCF5282_GPIO_PTDPAR = 0x0;
	
	/* Set Data Direction of DTOUT0,1,2,3 to Output */
	MCF5282_GPIO_DDRTC = 0x0F;
	MCF5282_GPIO_DDRTD = 0x0F;

	for (i = 0; i < 4; i++)
	{
		/* Write 0 to turn LEDs on */
		MCF5282_GPIO_PORTTD = 0x0A;
		MCF5282_GPIO_PORTTC = 0x0A;
		for (j = 0; j < 4000000; j++);
		
		/* Write 1 to turn LEDs off */
		MCF5282_GPIO_PORTTD = 0x0F;
		MCF5282_GPIO_PORTTC = 0x0F;
		for (j = 0; j < 5000000; j++);
	}

}
/********************************************************************/

⌨️ 快捷键说明

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