Re: Sending Chr(255) to Serial Port

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



.... <...@...> 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
.



Relevant Pages

  • Encoding/characterset/font family confusion
    ... I could use a bit of guidance on the following matter. ... attention to special characters. ... Postgresql db encoding scheme: LATIN1 ...
    (comp.lang.php)
  • Re: Rear Bushes 414.
    ... And he's just asked me what happens if they fail big style. ... posts were trying to get YOU to work out that what you were asking ... It doesn't matter WHAT goes wrong if it fails, ... >> car roadworthy, and you want to help him out. ...
    (uk.rec.cars.maintenance)
  • Re: SB Editorial on NCLB tests.
    ... (unless their parents/caregivers really care). ... It really does not matter whether ... school and go into a GED program. ... out the ones that fail. ...
    (soc.culture.hawaii)
  • Re: add edi,0FFFFFFFFH
    ... If you feel that encoding the longest possible form ... when a shorter form would do the same thing is ... True it is a matter of opinion. ...
    (comp.lang.asm.x86)
  • Re: UTF-8 Characters showing up as Gobbledy-Gook
    ... send data in response to HTTP requests. ... and it does not matter how they interact with the ... encoding will result if the interface specification for the data provided ... to the server is honoured. ...
    (comp.infosystems.www.authoring.html)