Are you sure your PIC burner is taking fuse bits from the hex file?
Did you noticed the fuse bits loaded in the programmer?
Any way, just try by grounding the RB3 pin using a 10K resistor and use my code above (modified now). Also don't forget to pull up the MCLR pin also...
Still if it is printing continuous U, then it may be the WDT resetting the PIC...(due to the fuse bit problem)...
Also check if there is an option to provide the fuse bits manually in the programmer...
---------- Post added at 11:27 ---------- Previous post was at 11:00 ----------
Still you can check if it is a watchdog problem by usign clear watchdog instruction when the pic waits in while loops.... But I think there will be the option of fuse bits in the programmer itself..
So which programmer are u using ?
---------- Post added at 12:13 ---------- Previous post was at 11:27 ----------
if it is the watchdog reset problem,
then try below code, I assume it will work,but any way I didn't tried and always I used to disable WDT in fuse bits.
CLRWDT() wil clear the watchdog timer and prevent overflow and thus prevent reset...
Code:
#include <htc.h>
__CONFIG(0x3f3a);
void init()
{
TRISC6 = 0;
TRISC7 = 1;
SPBRG = 12; // (4,000,000/4800baud/64)-1 for setting 4800baud
TXSTA = 0x20;
RCSTA = 0x90;
TXIE = 0; // disable TX interrupt
RCIE = 0; // disable RX interrupt
}
void main()
{
unsigned int i;
unsigned char temp = 0;
init();
[COLOR="#FF0000"] CLRWDT();[/COLOR]
TXREG = 'U';
while(1) {
while(!RCIF) {[COLOR="#FF0000"]CLRWDT();[/COLOR]}
while(!TRMT);
TXREG = RCREG;
}
}
If the above code works properly, then it means the WDT is not disabled..