Because rest of code is not visible, what about volatile key word for voltage and _voltage variables (seem be global).
Another posibility is different data types of varibles and parametrs.
About time issue i am not sure but maybe it is limit for this mcu and is permanently in ISR.
I do not know exact usage but is not PwmOut better for this?
Thanks very much. I want to generate a 100khz square wave with a certain voltage. So with no hardware changed, the "ticker + dac " or “dma + dac” mode can work. The “pwm+dac” mode can work also with “hardware analog switch”.
Oh oops nvm you mean that the amplitude of the square wave needs to be configurable, but it should still be a square wave?
Yeah I think the easiest way to do that would be to use a DAC to output a constant voltage, and then switch that voltage on and off via e.g. FET transistors or an analog switch IC.