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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:17:34+00:00 2026-05-13T10:17:34+00:00

I have a device (digital indicator) that I am communicating with using the SerialPort

  • 0

I have a device (digital indicator) that I am communicating with using the SerialPort class. The device documentation states that I need to have a 250 millisecond delay between writes. Is there a way to enforce this without putting extra delay into the system? I know this probably sounds like I’m worrying too much about something that’s really small, but there are three of these indicators and it is reading them quite often, but not all the time. Basically, is there a good way to enforce that you don’t send again in less than 250 milliseconds, but if it’s been 5 seconds and I try to send, I don’t want to delay an additional 250 milliseconds for no reason.

Thoughts?

  • 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-13T10:17:34+00:00Added an answer on May 13, 2026 at 10:17 am

    You should have some sort of class for the purpose of writing to the serial port, perhaps a single point of writing (a WriteToPort function or something).

    In that, you could save the current time every time you write, then use logic on the delay for that. SO:

    DateTime lastWritten;
    TimeSpan timeBetweenWrites = new Timespan(0,0,0,0,250);
    void WriteToDevice(string data)
    {
        TimeSpan sinceLastWrite=DateTime.Now-lastWritten;
        if(sinceLastWrite<timeBetweenWrites)
            Thread.Sleep(timeBetweenWrites-sinceLastWrite);
        SerialPort.Write(data);
        lastWritten=DateTime.Now;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a device which is stethoscope digital machine, so i attach that machine
I have a Device class that I have defined that has 2 properties, LocalConnection
Have a digital media device that I'd like to get the ImageMagick command-line tool
I created the list that have device detected, and I want to send data
I have a device on a network that I am attempting to ping through
We have a device that uses Exchange web services to download mail and calendar
I have a device that sends data to COM port. And I'd like to
HI, I have a device that exposes a telnet interface which you can log
I have device connected through serial port to PC. Using c-kermit I can send
I have a parent class that holds all of the fields that are common

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.