Re: Sending Chr(255) to Serial Port
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Thu, 3 Aug 2006 20:49:26 +0100
.... <...@...> wrote:
Sorry my lack of news, I've been a bit busy in other stuff ...thanks for
your input on the matter, after a while I was able to find the solution (I'm
not entirely convinced, still it works well, as I wanted)
It's definitely not a *good* solution - it may well fail when someone
tries it with a different default encoding, and it may well also fail
on some data even with your own default encoding.
The solution is like
SerialPort.Encoding = Encoding.Default
SerialPort.Write (char(255)+char(15)+...)
Using Encoding.ASCII I only got char(63) on the other side, but with Default
it works like a charm.
Use:
SerialPort.Write (new byte[] { 255, 15 });
instead. Why are you so keen to use characters?
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.
- Prev by Date: Re: Codecs
- Next by Date: Re: Recommended way to add child controls in CreateChildControls
- Previous by thread: Re: Sending Chr(255) to Serial Port
- Next by thread: MyBase.Closing and Me.FormClosing
- Index(es):
Relevant Pages
|