Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

UART Issue with PICDEM PlUS 2 board

  1. Jan 15, 2012 #1
    Hi Everyone

    I have a PICDEM 2 Plus board with a PIC18F4620 on it. My UART code is given. The code worked perfectly fine the first time i programmed my chip but stopped working after that.

    With Hyperterminal the error is : "Unable to open COMPORT 1. Please check your port setting"

    With RealTer , the error is : Break condition received

    With Putty : Nothing happens

    I performed a loopback test on the board ( by taking our the PIC ) and Serial-to USAB adaptor and both works fine. The comport on my laptop works fine with other UART. Please guide me..I AM SUPER LOST !

    Heres the code



    #include <p18f4620.h>
    #include <stdio.h>
    #include <delays.h>
    #include <usart.h>

    // INTIO67 configures internal oscillator
    #pragma config OSC=INTIO67, LVP=OFF, MCLRE=ON , WDT=OFF

    void setup(void)
    {
    /* Clock Setup*/
    OSCCON = 0b01110010; //select 8 MHz clock

    /* Port Set Up*/
    ADCON1 = 0b00001111; //set all pins to digital mode
    TRISD = 0x00;
    TRISA = 0x00;
    TRISB = 0b00000000;
    TRISC = 0b10000000; // RX is an input, TX is output

    // PORTBbits.RB0=1; //Turn on the 4 LEDs
    // PORTBbits.RB1=1;
    // PORTBbits.RB2=1;
    // PORTBbits.RB3=1;

    // Turn on the 4 LEDs
    // Microchip recommends writing to the PORT Latch rather than the PORT Pins
    LATBbits.LATB0=1;
    LATBbits.LATB1=1;
    LATBbits.LATB2=1;
    LATBbits.LATB3=1;


    /* Interrupt Setup */
    INTCON = 0x00; /* Clear Registers */
    PIR1 = 0x00;
    PIE1 = 0x00;
    TMR1L = 0x00;
    TMR1H = 0x00;
    T1CON = 0x00;
    RCON = 0x00;



    /* RS232 Enable */
    // OpenUSART Configures The Next Three Lines
    //RCSTA = 0b10000000;
    //TXSTA = 0b00100000;
    //BAUDCON = 0b01000000;

    // USART 9600 8-N-1
    OpenUSART (USART_TX_INT_OFF & USART_RX_INT_OFF & USART_ASYNCH_MODE & USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_LOW, 12);

    }


    #pragma code
    void main(void)
    {
    setup();

    while (1)
    {
    putrsUSART(" Hello World! ");
    // while(BusyUSART());
    Delay10KTCYx(100);

    }
    }
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted



Similar Discussions: UART Issue with PICDEM PlUS 2 board
  1. Uart and data rate (Replies: 12)

  2. Circuit boards (Replies: 5)

  3. Photosensor Issue (Replies: 0)

Loading...