If there's a clock cycle every 200 nanoseconds, that's 5000000 clock cycles a second (in other words, it's running at 5mHz)... So I should probably divide that by the sample frequency, so it knows how many cycles to pause for in between updating the output value, instead of dividing the sample frequency by 5, which probably does nothing useful at all.
If someone could grab a fresh copy of my script and tell me if the tuning's spot on or even worse now, that'd be really useful! :D
Thanks,
Zoë.