/*---------------------------------------------------------------------------------------------------------*/
/* */
/* Copyright(c) 2009 Nuvoton Technology Corp. All rights reserved. */
/* */
/*---------------------------------------------------------------------------------------------------------*/
#include <stdio.h>
#include "M051Series.h"
#include "Driver\DrvGPIO.h"
#include "Driver\DrvSYS.h"
void delay_loop(void)
{
uint32_t j;
for(j=0;j<60000;j++);
for(j=0;j<60000;j++);
for(j=0;j<60000;j++);
for(j=0;j<60000;j++);
}
/*---------------------------------------------------------------------------------------------------------*/
/* MAIN function */
/*---------------------------------------------------------------------------------------------------------*/
int main (void)
{
E_DRVGPIO_PIN sPinNumber;
/* SYSCLK =>12Mhz*/
UNLOCKREG();
SYSCLK->PWRCON.XTL12M_EN = 1;
LOCKREG();
/*set GP0 outpui*/
for(sPinNumber=E_PIN0;sPinNumber<=E_PIN7;sPinNumber++)
{
DrvGPIO_Open(E_PORT0,sPinNumber, E_IO_OUTPUT);
DrvGPIO_Open(E_PORT1,sPinNumber, E_IO_OUTPUT);
DrvGPIO_Open(E_PORT2,sPinNumber, E_IO_OUTPUT);
DrvGPIO_Open(E_PORT3,sPinNumber, E_IO_OUTPUT);
DrvGPIO_Open(E_PORT4,sPinNumber, E_IO_OUTPUT);
}
while(1)
{
for(sPinNumber=E_PIN0;sPinNumber<=E_PIN7;sPinNumber++)
{
DrvGPIO_ClrBit(E_PORT0,sPinNumber);
DrvGPIO_ClrBit(E_PORT1,sPinNumber);
DrvGPIO_ClrBit(E_PORT2,sPinNumber);
DrvGPIO_ClrBit(E_PORT3,sPinNumber);
DrvGPIO_ClrBit(E_PORT4,sPinNumber);
}
delay_loop();
for(sPinNumber=E_PIN0;sPinNumber<=E_PIN7;sPinNumber++)
{
DrvGPIO_SetBit(E_PORT0,sPinNumber);
DrvGPIO_SetBit(E_PORT1,sPinNumber);
DrvGPIO_SetBit(E_PORT2,sPinNumber);
DrvGPIO_SetBit(E_PORT3,sPinNumber);
DrvGPIO_SetBit(E_PORT4,sPinNumber);
}
delay_loop();
}
}
|