Forum Discussion
Altera_Forum
Honored Contributor
15 years agoThis code doesn't work if the CPU has a data cache. In that case it will read back the *switches value from the cache instead of reading the actual PIO value.
I guess it works when stepping in the code because the code executed by the debugger invalidates the cache line that used to hold the switches values, but it was pure luck. Use the IORD/IOWR macros to have a more reliable code.