Generate tone without tone library

Try this:

#define PERIOD (1000000L/(FREQ*2))

Also, read How to post code properly and do it.

Pete