The problem is that kDisplayPeriod is 0 at init time. That’s because its value is updated during the performance rather than initialisation. Consider this instrument:
k1 = 1
It will print 0 rather than 1 as the k-rate assignment is done at performance time. The simple fix for your code is to add a tiny number to the iDisplayPeriod so that on the first pass, when kDisplayPeriod is 0, it will still have a valid display period,
display aScopeIn, iDisplayPeriod+0.001, 1
After that you can update the period as you wish.