Author Topic: Timing Issue C#  (Read 11923 times)

Codette

  • Member
  • ***
  • Posts: 3
Timing Issue C#
« on: July 16, 2019, 05:05:56 pm »
Hi Jan,

We are using a USB port, and the USB port is a USB to RS-485 port. We're firing messages to controllers that then reply to us. We running into an issue where when we fire a message to the controllers in debug mode with breakpoints, the controllers reply because they have enough time to reply. But when we run the program without any breakpoints, the program won't wait, and the message gets fired out immediately. It looks like the program is ignoring the SerialPort.ReadTimeout() value we set. But maybe this is the wrong property to be looking at? I noticed there is a SerialPort.ReceivedBytesThreshold that gets the number of bytes before a DataReceived event occurs. Is this maybe the property we should be using with a DataReceived() event?

We have been using CoolTerm to verify that the controllers are working, and so we're very sure it's a software issue. We are using a Love Controls Series 16 A Temperature Processor Controller.

http://www.dwyer-inst.com/Product/Temperature/ProcessControllers/Series16A

Please see the attached file for the code we're using. Any help would be greatly appreciated.

Thanks!

Codette



Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research

Codette

  • Member
  • ***
  • Posts: 3
Re: Timing Issue C#
« Reply #2 on: July 22, 2019, 10:24:04 am »
Hi Jan,

Thank you very much for your reply. We decided to use .ReadBytes() instead of .Read() and were able to get the program working that way. Again, thanks for the help!

Codette

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Timing Issue C#
« Reply #3 on: July 22, 2019, 01:17:55 pm »
Glad you got it working. Thanks for reporting your solution.

Codette

  • Member
  • ***
  • Posts: 3
Re: Timing Issue C#
« Reply #4 on: July 22, 2019, 01:24:30 pm »
You're welcome!  :)