dec643_gpio.c

来自「合众达DEC643 GPio例程。指示灯闪烁」· C语言 代码 · 共 59 行

C
59
字号
/********************************************************************/
/*  Copyright 2004 by SEED Incorporated.							*/
/*  All rights reserved. Property of SEED Incorporated.				*/
/*  Restricted rights to use, duplicate or disclose this code are	*/
/*  granted through contract.									    */
/*  															    */
/********************************************************************/
/*
	Designed by: Hongshai.Li
	Build:	06.21.2005
	Modify:
	Discription:The routine blinks led D2.
*/
/********************************************************************/

#include <csl.h>
#include <stdio.h>
#include <csl_irq.h>
#include <csl_gpio.h>

#include "DEC643.h"
/*********************************************************************/
	/* GPIO configuration */

/*********************************************************************/
static GPIO_Handle hGpio;
extern far void vectors();
/*********************************************************************/
main()
{
	/* Initialize CSL,must when using CSL. */
	CSL_init();
	
	/*Initialize interrupt vector*/
    IRQ_setVecs(vectors); 
    IRQ_nmiEnable();
    IRQ_globalEnable();
    
    /* Set GPIO. */
    hGpio = GPIO_open(GPIO_DEV0,GPIO_OPEN_RESET);
    GPIO_reset(hGpio);
    GPIO_pinEnable(hGpio,GPIO_PIN14);
    GPIO_pinDirection(hGpio,GPIO_PIN14,GPIO_OUTPUT);
    /* Blinks led D2. */
    while(1)
	{
		GPIO_pinWrite(hGpio,GPIO_PIN14,0);
		DEC643_waitusec(500000);
		GPIO_pinWrite(hGpio,GPIO_PIN14,1);
		DEC643_waitusec(500000);
	}

}
/*********************************************************************/
/*	End of DEC643_GPIO. */
/*********************************************************************/


⌨️ 快捷键说明

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