abstraction for using xtag2 as squarewave generator