This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

user keyboard input via uart usb port

hi how can i give keyboard input via uart usb port to write it on the lcd of arm cortex m3

Parents
  • yes i'm using arm cortex m3 lm3s811 with usb port that also supports data stream through uart, default code for it is given as
    int
    main(void)
    { // Set the clocking to run directly from the crystal. SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_6MHZ);

    // Initialize the OLED display and write status. OSRAMInit(false); OSRAMStringDraw("UART echo: UART0", 0, 0); OSRAMStringDraw("115,200, 8-N-1", 6, 1);

    // Enable the peripherals used by this example. SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

    // Enable processor interrupts. IntMasterEnable();

    // Set GPIO A0 and A1 as UART pins. GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

    // Configure the UART for 115,200, 8-N-1 operation. UARTConfigSet(UART0_BASE, 115200, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));

    // Enable the UART interrupt. //IntEnable(INT_UART0); //UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT);

    // Prompt for text to be entered. // UARTSend((unsigned char *)"Enter text: ", 12); // UARTSend((unsigned char *) "def", 12);

    // Enable the UART. UARTEnable(UART0_BASE);

    // Check for characters. This will spin here until a character is placed // into the receive FIFO. //while(!UARTCharsAvail(UART0_BASE)) //{ //}

    // Get the character(s) in the receive FIFO. //while(UARTCharNonBlockingGet(UART0_BASE)) //{ //} // I have to comment out those lines, because it goes into infinite loops.

    // Put a character in the output buffer. // is the character 'c' being written to the UART? or is it in the buffer? do I need to enable FIFO buffers?

    // Disable the UART. // Loop forever echoing data through the UART. while(1) {

    }
    }

    while searching on internet if found charput and charget functions but don't know how to use it in my code

Reply
  • yes i'm using arm cortex m3 lm3s811 with usb port that also supports data stream through uart, default code for it is given as
    int
    main(void)
    { // Set the clocking to run directly from the crystal. SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_6MHZ);

    // Initialize the OLED display and write status. OSRAMInit(false); OSRAMStringDraw("UART echo: UART0", 0, 0); OSRAMStringDraw("115,200, 8-N-1", 6, 1);

    // Enable the peripherals used by this example. SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

    // Enable processor interrupts. IntMasterEnable();

    // Set GPIO A0 and A1 as UART pins. GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

    // Configure the UART for 115,200, 8-N-1 operation. UARTConfigSet(UART0_BASE, 115200, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));

    // Enable the UART interrupt. //IntEnable(INT_UART0); //UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT);

    // Prompt for text to be entered. // UARTSend((unsigned char *)"Enter text: ", 12); // UARTSend((unsigned char *) "def", 12);

    // Enable the UART. UARTEnable(UART0_BASE);

    // Check for characters. This will spin here until a character is placed // into the receive FIFO. //while(!UARTCharsAvail(UART0_BASE)) //{ //}

    // Get the character(s) in the receive FIFO. //while(UARTCharNonBlockingGet(UART0_BASE)) //{ //} // I have to comment out those lines, because it goes into infinite loops.

    // Put a character in the output buffer. // is the character 'c' being written to the UART? or is it in the buffer? do I need to enable FIFO buffers?

    // Disable the UART. // Loop forever echoing data through the UART. while(1) {

    }
    }

    while searching on internet if found charput and charget functions but don't know how to use it in my code

Children
No data