Altera_Forum
Honored Contributor
14 years agoProblem with IORD_ALTERA_AVALON_PIO
hi,
i want to write a simple code witch can turn on a led when i press a button. i have write this piece of code but seems doesn't works... here is my code:
int main()
{
volatile long BOUTONS_ON;
while(1)
{
BOUTONS_ON = IORD_ALTERA_AVALON_PIO_DAT(KEY_LINE_BASE);
if ((BOUTON_ON & 0x1) == 0x1)
{
Led2_ON();
}
else
{
Led2_OFF();
}
}
return 0;
}
the build works but the instruction seems to be always true Led2 is always turned ON. maybe i have missed something or my code must be writted diffrently