2
#include <p18f45k22.h>
#include <usart.h>

char uart_rd;

void main(void)
{

ANSELC = 0;

Open1USART(USART_TX_INT_ON &             // disables transmission interrupt     
           USART_RX_INT_OFF &// disables reception interrupt                            
           USART_ASYNCH_MODE & // sets USART to asynchronous mode  
           USART_EIGHT_BIT&  // sets USART to use 8-bit data mode 
           USART_CONT_RX &   // sets the port in continues receive mode 
           USART_BRGH_HIGH,   // uses the low speed Baud rate formula 
          52 // sets Baud to 9600 BPS using 8MHz in calculation (actual baud rate is 9600.614)
            );  

while (1) 
{ 
putrs1USART ("Hello world!\n"); 
} 

} 

I am not getting anything on hyper terminal. Do I need to add or remove anything from code.

Help is appreciated.

Cheers

akumar
  • 49
  • 1
  • 9
  • You've set the port to continuous receive mode; this will cause the PIC to be in RX mode, whereas you want it to be in TX mode and the PC to be in RX mode. Try setting it to TX and see if that helps. – paul Feb 14 '13 at 16:35
  • Thanks for reply. Could you tell me which specific bit I need to change. Cheers – akumar Feb 14 '13 at 16:51
  • I'm guessing you'd have to change `USART_CONT_RX` to `USART_CONT_TX`, but I'm not sure (I don't know the constants). Try consulting the documentation for that function. – paul Feb 14 '13 at 16:54
  • Btw, this question is somewhat open ended and so isn't the best fit the question/answer format of StackOverflow (so I expect it'll get closed); you might want to try asking over on the [microchip forums](http://www.microchip.com/forums/) instead, as that's more geared towards back-and-forth conversations. – paul Feb 14 '13 at 16:54

0 Answers0