dowload this code i do many weeks ago based on TIMER1

PWM, SERIN/SEROUT are really often ask here. If u do a search, you'll probably found a bit less hits than the quantity of thread