#include <stdio.h>
#include "DrvGPIO.h"
#include "DrvSYS.h"
#include "NUC1xx.h"
void delay(uint32_t i)
{
uint32_t j;
while(i--)
{
for(j=0;j<1000;j++);
}
}
int main ()
{
UNLOCKREG();
SYSCLK->PWRCON.XTL12M_EN=1;
LOCKREG();
DrvGPIO_Open(E_GPB,14,E_IO_INPUT );
DrvGPIO_Open(E_GPB,10,E_IO_OUTPUT);
while(1)
{
if (DrvGPIO_GetBit(E_GPB,14) == 0)
{
DrvGPIO_SetBit(E_GPB,10);
}
if (DrvGPIO_GetBit(E_GPB,14) == 1)
{
DrvGPIO_ClrBit(E_GPB,10);
}
}
} |