There is a function in the ViVA calculator called getAsciiWave which does this already, so there's no need to write anything.
In reply to Andrew Beckett:
Thanks Andrew - that helped.
Is there a way to set units on the x-axis? ViVA doesn't let you overlay if the units don't match..
One way of course is to dump the sim-generated waveform into a file and get rid of its units and plot that also using getAsciiWave..
In reply to azde:
Yes, you can use the code in solution 11609072 for this. From IC616 ISR3, you'll also be able to mark the axes as accepting any units ("flexible axes"), and this will allow different signal types to be plotted together more easily.
The code in the solution allows you to register calculator functions for abSetUnits() and abSetXUnits() (the first does the Y axis).