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 899247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:11:10+00:00 2026-05-15T15:11:10+00:00

I am working on robot which has to control using wireless serial communication. The

  • 0

I am working on robot which has to control using wireless serial communication. The robot is running on a microcontroller (by burning a .hex file). I want to control it using my Linux (Ubuntu) PC. I am new to serial port programming. I am able to send the data, but I am not able to read data.

A few piece of code which is running over at the microcontroller:

Function to send data:

void TxData(unsigned char tx_data)
{
    SBUF = tx_data;  // Transmit data that is passed to this function
    while(TI == 0)   // Wait while data is being transmitted
        ;
}

I am sending data through an array of characters data_array[i]:

  for (i=4; i<=6; i++)
  {
      TxData(data_array[i]);
      RI = 0;              // Clear receive interrupt. Must be cleared by the user.
      TI = 0;        // Clear transmit interrupt. Must be cleared by the user.
  }

Now the piece of code from the C program running on Linux…

while (flag == 0) {
    int res = read(fd, buf, 255);
    buf[res] = 0; /* Set end of string, so we can printf */
    printf(":%s:%d\n", buf, res);
    if (buf[0] == '\0')
        flag = 1;
}

It prints out value of res = 0.

Actually I want to read data character-by-character to perform calculations and take further decision. Is there another way of doing this?

Note: Is there good study material (code) for serial port programming on Linux?

How can I read from the Linux serial port…

  • 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-15T15:11:11+00:00Added an answer on May 15, 2026 at 3:11 pm

    First, take a look at /proc/tty/driver/serial to see that everything is set up correctly (i.e., you see the signals you should see). Then, have a look at the manual page for termios(3), you may be interested in the VMIN and VTIME explanation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 501k
  • Answers 501k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The best thing you can do inside the file search… May 16, 2026 at 2:19 pm
  • Editorial Team
    Editorial Team added an answer Amazon added an Invalidation Feature. This is API Reference. Sample… May 16, 2026 at 2:19 pm
  • Editorial Team
    Editorial Team added an answer Yes, there is a perfect way to accomplish this in… May 16, 2026 at 2:19 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am using the reportviewer control from VS 2010 to create client side reports
I'm working on a small fun projects that builds a robot. We as the
I've registered a control in my web.config file and the .dll for the control
I'm working on a view-based iPhone app that has the following flow: search ->
I have a JSON data store used for a combobox selection which is working
I'm working on a simple c program that has to connect to my database,
I'm working with an unmanaged library through P/Invoke and it uses three structs (although
In our team we have a database project in visual Studio 2008 which is
I'm working on a .NET 4 application, C#, Entity Framework 4, SQL Server 2008.
My website structure has a root /index.php, some files as /directory/index.php and some as

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.