dsPIC30F6015, ede114.

Discussion in 'Embedded Systems and Microcontrollers' started by acampos1, Feb 5, 2012.

  1. acampos1

    Thread Starter New Member

    Feb 5, 2012
    1
    0
    I am trying to display on the LCD screen the key of the keypad. For that to happen I am using a keypad encoder(ede 1144). I have the keypad encoder connected to 9600. Every time I enter a key, what is display is 255, instead of the actual key I pressed. I am not really familiar with the UART, so could anybody take a look at my code. Thanks


    void initUART()
    {
    U2MODEbits.UARTEN = 1;
    U2MODEbits.PDSEL0 = 0;
    U2MODEbits.PDSEL1 = 0;
    U2MODEbits.STSEL = 0;
    U2STA = 1;
    IFS1bits.U2RXIF = 0;
    IEC1bits.U2RXIE = 1;

    U2BRG = 0X00C7;

    }
    void __attribute__((__interrupt__)) _U2RXInterrupt(void)
    {
    char buff[50];
    sprintf(buff, "%i", U2RXREG);
    Send_String(buff);

    IEC1bits.U2RXIE = 0;
    U2MODEbits.UARTEN = 0;
    //RTFbits.RF5 = 1;
    IFS1bits.U2RXIF = 0;
    IEC1bits.U2RXIE = 1;
    U2MODEbits.UARTEN = 1;
    }