is it possible to generate a 40khz continuous square wave of amplitude 5v using a pic ..??
when i first started playing with PICs i didn't have an oscilloscope for tuning timing routines.
the best way i found of getting accurate timing pulses was to programme in machine code and manually count the number of instructions.
PICs usually process one instruction per 4 clock cycles. (unlike AVRs which process one instruction per cycle. you AVR freaks can get on your soap boxes now...)
some instructions take more than 4 clock cycles (but always a multiple of 4). the data sheets should be able to tell you which ones.
so, simply count how many instructions the program passes through, multiply by 4 and that's how many clock ticks the programme has gone through.
NOP commands can be used to add further delay. (i think it stands for No OPeration or something like that.)
i think the other posts answer your other 2 questions.
dunk.