Well, the way I generate square waves is usually with PWM, but it's highly unlikely that all 13 ports are PWM ports. With that said, I'm sure you could just run a timer and turn the output high and low when the counter gets to a certain number.
Now, since this sounds like an assignment, I'll let you figure out how to do that (it's really easy).