add square wave function for function generator