Forum Discussion
Altera_Forum
Honored Contributor
15 years ago2 Leds -> how many PIO?
Hi all, I'm writing a simple program on interrupt behaviour, with an interval timer (that generate timer interrupt and its handler make a ledg blink) and an hardware interrupt generated by a bu...
Altera_Forum
Honored Contributor
15 years agoJust be careful in the software, since changing the state of one LED requires a read/modify/write sequence - which mustn't be interrupted.
This can be avoided by defining 2 registers, one to set the LED, the other to clear it. In reality whether you use 32 address locations for 32 LEDs, or one address and 32 data bits depends on how you need to access them. If you want to set/clear/read the values all at once then a single (or a set/clear pair) of PIO registers in needed. If you only ever set a single LED, then separate addresses may be more useful. The thing about an FPGA design is that you can change your mind!