i made like this
typedef struct sBit
{
alt_u8 B0 :1;
alt_u8 B1 :1;
alt_u8 B2 :1;
alt_u8 B3 :1;
alt_u8 B4 :1;
alt_u8 B5 :1;
alt_u8 B6 :1;
alt_u8 B7 :1;
alt_u8 B8 :1;
alt_u8 B9 :1;
alt_u8 B10 :1;
alt_u8 B11 :1;
alt_u8 B12 :1;
alt_u8 B13 :1;
alt_u8 B14 :1;
alt_u8 B15 :1;
}sBit;
typedef union sDato // Una Union differisce dalla struct per il fatto che il dato e' condiviso
{
alt_u8 W;
sBit B;
}sDato;
sDato count;
sDato mem;
.....
.....
while(1)
{
count.W=IORD_ALTERA_AVALON_PIO_DATA(PM_IN_BASE);
if(count.B.B0) & (!mem.B.B0)
{
//execute code
mem.B.B0=true;
}
if(!count.B.B0)
{
mem.B.B0=false;
}
}
//now it's functionally
ciao
walter