Since you are talking about two different setups to apply frequencies, you will need to make two programs.
The first would use the square wave and contain the frequency set you wish to use the square wave with.
The second would use the other waveform you wanted, and contain the other frequency set.
Then you could put them together using a chain.
There is really no other way to do this as you are changing operating parameters between the two.
For more details, please check the link: