PI
From Fpga4u
Let's complicate things and use the parallel port. First the input, then the output and finally the two at the same time.
- Add a PIO with SOPC Builder: Other -> PIO and select inputs only
- Select Quartus for the pin assignment, generate
- Update the block diagram, correct the inputs and outputs (they have moved after reloading). Add 8 switches on inputs; analyze, assign the remaining pins (use the excel file)
- Program the FPGA
- Modify the NIOS II IDE project to read the the switches and display the result on the stdout:
- include the "system.h" file
- add a pointer on the PIO base register (you can find all necessary information into the driver file: in the left frame, open "Device Drivers [SOPC Builder]" -> "altera_avalon_pio" -> "inc" -> "altera_avalon_pio_regs.h"
- print the value of the register