Hello!
You may consider first looking at existing (and working)
sample code, tutorials.
What you are asking belongs to basics, and I'm sure there is a tutorial that you could
first try, verify, modify, try if it still works and then ask very specific questions if it
doesn't.
For instance, if you say: I tried this tutorial, and it works. I then change line ##
to <something else> and it doesn't work anymore. Why?
This way, somebody who wants to help you would check only what has changed in line##
and could reply at once, without having to download your code, crreate a project for you
and debug it.
Second thing: you should avoid hard coded values. For instance 0x20. Why not
#define TXEN 0x20 ?
Why not #define BAUD_115k 0x17
and then write TXSTA = TXEN; and SPBRG = BAUD_115k;
The advantage is that you don't even need to write comments.
By the way, I don't know if it's the case, but TXEN looks like TX enable. What about
RXEN? I mean: if the reception is not enabled, you will likely wait a while until the
interrupt comes. Just guessing, I have never used PIC.
Regards,
Dora.