Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6978565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:46:24+00:00 2026-05-27T17:46:24+00:00

I am trying to read data from a serialport. When i use USB adapters

  • 0

I am trying to read data from a serialport. When i use USB adapters i get junk instead of what is sendt.

What i expect (And get with a normal serialport)

 0001 C0  23:33:41.9114 00
 0001 C1  23:34:17.8207 00
 0001 RT  00:00:35.90   00
n0002
 0002 C0  23:34:32.8372 00
 0002 C1  23:42:36.2617 00
 0002 RT  00:08:03.42   00
n0003
 0003 C0  23:42:44.3947 00

What i get when connected through a USB serial port (0x00 0x3F …)

003F003F783F003F003F003F003F003F
003F003F003F003F003F3F3F3F003F00
3F3F78003F003F003F003F003F780000
3F003F783F003F003F003F003F003F00
3F003F003F003F003F3F3F3F003F003F
3F78003F003F00

Also when i use Putty to connect it displays correct texte even through USB serial port.

What can be wrong here? How does Putty “fix” the corrupt data.

Edit: Added code used for reading

    SerialPort p = new SerialPort(Conf.Value("ExternalClockPort"), int.Parse(Conf.Value("ExternalClockBaud")), Parity.None, 8, StopBits.Two);
p.Handshake = Handshake.RequestToSend;
p.Open();
byte[] buffer = new byte[512];
String command = "";
while (!Done)
{
    int cnt = p.Read(buffer, 0, buffer.Length);
    File.AppendAllText(this.appDataDirectory + "ExternalClock.log", ASCIIEncoding.ASCII.GetString(buffer, 0, cnt));
    command = ExternalClock.parseCommand(command + ASCIIEncoding.ASCII.GetString(buffer, 0, cnt));
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:46:25+00:00Added an answer on May 27, 2026 at 5:46 pm

    OK, so you need to register an event DataRecieved and read the port data from it. Also, make sure your port initialization values are correct.

    _sp = new SerialPort(Conf.Value("ExternalClockPort"), int.Parse(Conf.Value("ExternalClockBaud")), Parity.None, 8, StopBits.Two);
    _sp.DataReceived += new SerialDataReceivedEventHandler(Port_DataReceived);
    _sp.Open();
    
    
    private void Port_DataReceived(object sender, SerialDataReceivedEventArgs e)
    {
        int totalBytes = _sp.BytesToRead;
        byte[] buffer = new byte[totalBytes];
        _sp.Read(buffer, 0, totalBytes);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use GetThemeFont to read the font data from a visual
I read data from MS Access using C#. But get the OleDbException trying to
I'm trying to read data from csv file, but instead of e.g. 001000 I
I'm trying to read data from a.csv file to ouput it on a webpage
I am trying to read data from excel files using datatable. The command select
I'm trying to read data from SQL Server database using Perl and the DBI
I am trying to read data from an RS-232 port. Does anyone have an
I am trying to read data from a file stream as shown below: fileStream.Read(byteArray,
I am trying to read data from a bluetooth barcode scanner (KDC300) using C.
I'm trying to read binary data from a specific offset. I write the data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.