Square wave generator