You also need to set the PIC registers and to get reliable 9600 baud rate you need to ensure the PIC is running at 4Mhz as serial out assumes a 4mhz timing base
From the BPB manual
You need to read section 3.5.2 of the datasheet on how to configure the internal oscillator HFINTOSC which is factory calibrated to 8Mhz, The frequency of the HFINTOSC can be altered via software using the OSCTUNE register (see the Register section 3-2).SEROUT2 assumes a 4MHz oscillator when generating its bit timing. To maintain the proper baud rate timing rate with other oscillator values, be sure to DEFINE the OSC setting to the new Oscillator value. An oscillator speed faster than 4MHz may be required for reliable operation at 9600 baud and above
The point of mentioning this is that you really need to spend time developing the hardware as well as the software... the two go hand in hand.
It may seem that we've come down hard on you, but then you must appreciate that the guys here see 100's of posts from new members who ask for help, but don't want to put the effort in from the start. The guys here (Henrik, Tabsoft and Richard to name a few) are very helpful and have lots of coding experience, and it's only fair to have done the ground work first, and then they are only too pleased to help (and I'm talking from experience here)




Bookmarks