OK, So I tried your code for printing an error message to the console only when the axis state changes to disabled. This works as expected.

I then added the following into the for loop with the print line. It compiles but does nothing to the DAC output. Maybe I'm misusing the DAC command, but nothing I've tried in a C program has any effect on the DAC output.

Code:
DAC(8,0);
After further experimentation, I have realized that the voltage is remaining at the last commanded DAC voltage when the axis is disabled. For example a move of 30000 counts results in a remaining DAC voltage of -3.517V, and a move of -30000 counts with the same settings results in a remaining DAC voltage of +3.517V. If I use a console command I can reset the DAC output to zero and re-enable the axis and it doesn't move.