Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

how can I receive messages (line by line) through serial port from microcontroller by received event like hyperterminal?

$
0
0

Dear friends,

I have programmed a small form for receiving messages from a microcontroller through a serial port.

when I use readline() method in the event of clicking a button (open port), it can receive a line of messages sending from microcontroller and show it in a textbox.

But I need to receive continuously the messages without pressing any button after opening serial port until closing the port in a multi line textbox with vertical scrollbar.

I used serialPort1_DataReceived event but I don't exactly what should I write in this event function. I tested readByte() and readChar() I couldn't receive any thing.

The microcontroller is sending data character by character with a very small delay (in order of micro seconds) in between and at the end of every message, there is \n\r.

Could you guide me to solve this problem? Should I read character by character? How? Do I need to define another function/method?

I appreciate a lot in advance.


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>