You would need to put 'a' into the TXREG, but other than that, yes...I was thinking to transmit the dta from uc to PC for this will this will work OK??Rich (BB code):#include <htc.h> __CONFIG(LVP_OFF & BOREN_OFF & PWRTE_ON & WDTE_OFF & FOSC_HS); #define _XTAL_FREQ 20000000 unsigned char HSerin(void); void HSerout(unsigned char ch), HSerinit(void); void main(void) // program entry { int index = 0; unsigned char ch; ADCON1 = 0x6; // Analogue off HSerinit(); __delay_ms(150); while(1) // endless Loop { HSerout(ch); // Echo back } } void HSerinit() { TRISC = 0xC0; // should ideally be set SPBRG = 129; // 20Mhz xtal 9600 BAUD TXSTA = 0x24; // TXEN and BRGH RCSTA = 0x90; // SPEN and CREN } void HSerout(unsigned char ch) { while(!TXIF); // Wait for module to finish TXREG = ch; // ready to send }
TXREG = 'a';
I am not familiar with RealTerm, but it seems some other people have had issues doing this with it... perhaps you could try TeraTerm?