0
\$\begingroup\$

enter image description here

I have a scenario that,

When receiving data through UART (STM) ,same time the data is displayed in the notepad(opened in PC) through USB.

How can I implement this?

I am using stm32 micro controller

Figure(as given)

For example,

The data received by STM is employee id,at the same time data should displayed in PC.

Note:

I too have LPC1768

\$\endgroup\$
  • 1
    \$\begingroup\$ Please clearify your specific problem \$\endgroup\$ – Daniel K Jul 8 at 7:17
  • 1
    \$\begingroup\$ You could use third party apps or use command prompt or powershell. Is it an absolute requirement to use notepad? \$\endgroup\$ – Prateek Dhanuka Jul 8 at 7:18
  • \$\begingroup\$ @PrateekDhanuka notepad is not a requirement .. \$\endgroup\$ – Shavan We Jul 8 at 7:21
  • \$\begingroup\$ You could use other text editors such as notepad++ or the command prompt itself to achieve this. \$\endgroup\$ – Prateek Dhanuka Jul 8 at 7:25
  • 1
    \$\begingroup\$ @PrateekDhanuka sir please give me the step to implement \$\endgroup\$ – Shavan We Jul 8 at 7:27
3
\$\begingroup\$

If you want data to Notepad, then the STM32 must be a keyboard HID to the PC, and it must convert serial data to keyboard presses. STM32 must have USB. But this may not be what you want.

If however the point is to watch serial data on screen and log it to a file, you would use a terminal program like putty to open a serial port. No microcontroller involved, just get a suitable serial cable or USB to serial adapter and it is done.

\$\endgroup\$
  • \$\begingroup\$ "If you want data to Notepad, then the STM32 must be a keyboard HID to the PC, and it must convert serial data to keyboard presses. STM32 must have USB. But this may not be what you want." ----> Thats i wanted \$\endgroup\$ – Shavan We Jul 9 at 3:16
1
\$\begingroup\$

You can use Notepad++ to view data in a text file.

From within Notepad++: Settings > Preferences > MISC.

From there, you can check "Update silently" and "Scroll to the last line after update" in the group "File Status Auto-Detection"

Or you can use the command prompt as well, simply use Tail -n 0 -f pathtotextfile

\$\endgroup\$
1
\$\begingroup\$

It's simple, build a UART to USB converter. You can build that on a breadboard. You can used FTDI IC. SOme microcontrollers are programmed through FTDI chips which converts RX/TX signals to USB's D+/D- signals.

As for a software to view received data from UART, you can use Terra Term.

\$\endgroup\$
1
\$\begingroup\$

I'm not sure if the STM32 is a requirement or just happens to be the hardware you saw and began trying with. However, there is much easier hardware (than stm32) to use to do this.

If you get an arduino Leonardo you can do this with a few lines of code. You can pick up three Leonardos for $20USD.

The Leonardo is small and will be seen as an HID device as soon as you connect it to your computer. It uses the ATMega 32u4 which implements HID USB so you don't have to do all that work.

Once you get the Leonardo the code is as simple as this example shows: https://www.arduino.cc/en/Tutorial/KeyboardSerial

#include "Keyboard.h"

void setup() {
  // open the serial port:
  Serial.begin(9600);
  // initialize control over the keyboard:
  Keyboard.begin();
}

void loop() {
  // check for incoming serial data:
  if (Serial.available() > 0) {
    // read incoming serial data:
    char inChar = Serial.read();

    // Type the next ASCII value from what you received: 
    // this sends the data to your computer as if a user typed it on a keyboard.
    Keyboard.write(inChar + 1);
  }
}
\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.