NIOS II programming is easy with the default include files and functions. An alternative to write to registers using simple C programming can be the following:
IOWR() uses the ‘stio’ instruction in order to bypass the data cache.
int *sensor_reg0 = (int)*SENSOR_BASE; *(sensor_reg0) =0xAA;
SENSOR_BASE, which is an address in this example, should have its 31th bit set in order to bypass the data cache.