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

  • SEARCH
  • Home
  • 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 8387145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:07:56+00:00 2026-06-09T18:07:56+00:00

I have to send file byte-by-byte to serially connected AT89s52 from computer (VB.NET). Every

  • 0

I have to send file byte-by-byte to serially connected AT89s52 from computer (VB.NET).
Every sended byte have some job to do in microcontroller what require some time.
Here is relevant part of my C code to receiving bytes:

SCON = 0x50;
TMOD = 0x20; // timer 1, mode 2, 8-bit reload
TH1  = 0xFD; // reload value for 9600 baud
TR1  = 1;
TI   = 1;

again:

        while(RI!=0)
        {
            P1=SBUF;          // show data on led's
            RI=0;
            receivedBytes++;
        }

        if (key1==0)
        {
            goto exitreceive; // break receiving
        }

        show_lcd_received_bytes(receivedBytes); 
        // here is one more loop 
        // with different duration for every byte
        goto again;

And here is VB.NET code for sending bytes:

    For a As Integer = 1 To 10
        For t As Integer = 0 To 255
            SerialPort1.Write(Chr(t))
        Next t
    Next a

Problem is that mC have some job to do after every received byte and VB.NET don’t know for that and send bytes too fast so in mC finishes just a part of all bytes (about 10%).
I can incorporate “Sleep(20)” in VB loop ant then thing will work but I have many of wasted time because every byte need different time to process and that would be unacceptable slow communication.

Now, my question is if 8051 can set some busy status on UART which VB can read before sending to decide to send byte or not.
Or how otherwise to setup such communication as described?
I also try to receive bytes with serial interrupt on mC side with same results.

Hardware is surely OK because I can send data to computer well (as expected).

  • 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-06-09T18:07:58+00:00Added an answer on June 9, 2026 at 6:07 pm

    Your problem is architectural. Don’t try to do processing on the received data in the interrupt that handles byte Rx. Have your byte Rx interrupt only copy the received byte to a separate Rx data buffer, and have a background task that does the actual processing of the incoming data without blocking the Rx interrupt handler. If you can’t keep up due to overall throughput issue, then RTS/CTS flow control is the appropriate mechanism. For example, when your Rx buffer gets 90% full, deassert the flow control signal to pause the transmit side.

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

Sidebar

Related Questions

I have a byte[] with the contents of file. I would like to send
i have an form which will send some data to an php file ,
I have to send a byte array (encoded photo) from my PHP client to
I have to send the audio data in byte array obtain by recording from
I have two very similar pieces of ASP.NET code that send a file in
I have problem in uploading .doc file to .Net WCF from my Android app.
Guide me through this exception. I have been trying to send a file from
I have to send .csv file to remote server through REST in rails. I
In my application I have to send a picture as the attached file using
I have two files client.php and server.php. The client file send a HTTP request

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.