Author Topic: Serial Port behaving oddly!  (Read 4143 times)

GlennP

  • Frequent Contributor
  • ****
  • Posts: 141
Serial Port behaving oddly!
« on: March 04, 2013, 12:05:36 pm »
Hi all,

I am trying to replicate HyperTerminals way of sending a command.  I have written an Application in C# to emmulate and older hand held unit.  The documentation is very poor I have found one command that does not operate the way the rest do and have to use
myComPort.WriteLine() to get a responce from this unit as with all the others need a \r & \n which I appeand to a Write. This command appends a New Line  or '\r' if I am right.
In HyperTerm if you type "/cw 1c 5" the board responds when it is read back with #05000000, sent by my program (using the WriteLine) /cw 1c 5 will return #05FFFF00 meaning that some thing is appended to the end where as if I use the method I have used before it returns #0F000000. I am thinking something  is appended.  I would like some ideas, or port monitors to see if I am right and some thing is getting corrupted.   Ideas please!!
Glenn         

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2827
    • Lakeview Research
Re: Serial Port behaving oddly!
« Reply #1 on: March 04, 2013, 04:45:48 pm »
Set TextWriter.NewLine to the line terminator you want:

http://msdn.microsoft.com/en-us/library/system.io.textwriter.newline.aspx

GlennP

  • Frequent Contributor
  • ****
  • Posts: 141
Re: Serial Port behaving oddly!
« Reply #2 on: March 05, 2013, 03:52:57 am »
Thanks for that!
Glenn