Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

edge capture

The following piece of code should react to the falling edge of a 1-bit input pio and count the falling edges of a signal.

settings: no interrupt

synchronous capture

falling edge

After one falling edge the loop is continously run.

With a DSO it was detected that edge capture register was not cleared. How does one reset edge capture register properly? Where is my mistake?

Thanks in advance.

andy

------

while(counter<=end)

{

while(edge_capture==0)

{

edge_capture=IORD_ALTERA_AVALON_PIO_EDGE_CAP(BASE);

}

edge_capture=0;

IOWR_ALTERA_AVALON_PIO_EDGE_CAP(BASE,0x0);

counter++

}

---
No RepliesBe the first to reply