Sweep generator, written on VB6 (sorry!)