Forum Discussion
Altera_Forum
Honored Contributor
15 years agoAbout your C code:
you shouldn't call printf() from an ISR. It will probably try also to use interrupts, and it can freeze the system. Instead, define a global variable, change its value inside the isr, put the printf() in your main() function and have it print something when the contents of the global variable changes. About your Verilog code: put everything inside the always @ (posedge clk_i) block. You shouldn't use the signal read_i as a clock. Instead, detect changes in read_i by comparing it to its previous value inside the main block that depends on clk_i. Using a signal as a clock will lead to all kind of problems on your design, including transitions at unwanted moments due to glitches.