Re: Sending Chr(255) to Serial Port
- From: "Vincent" <mcnabb.vincent@xxxxxxxxx>
- Date: 2 Aug 2006 06:25:28 -0700
The fact IS, that SerialPort IS A STREAM, it has a property called
"Encoding" which you would have seen if you bothered to look in the
list that appears after you press the dot. Remember, the dot requires
you to use ONE finger, by placing it about the dot key, and moving it
down and up, a distance of less than half an inch. So difficult for
someone who wrote a book on the subject. I'm surprised really,
considering you wrote the book you should know this????
mySerialPort.Encoding = Encoding.ASCII;
mySerialPort.Write((char)255);
Hook it up to a computer with a nice terminal programme (e.g. one of
the ones that they had that were actually good before GUI's lip-stuck
everything) and you will see a nice little <FF> appear. Magical ! Wow!
Although I agree with the poster that one should use bytes...
....because it makes more simple. Though of course, things are simpler
if you use a real programming language like c, where byte and char are
pretty much the same thing. Why didn't they keep char, and make a new
one called unchar (e.g. unicode character)? I don't know, just to
confuse those of us who considered a char to be 8 bits, but now it is
32 bits.
*** Grier wrote:
Interesting. Have you actually tried this? What syntax do you suggest?
Write does not accept a Stream, so I'm puzzled.
***
--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
.
- Follow-Ups:
- Re: Sending Chr(255) to Serial Port
- From: Jon Skeet [C# MVP]
- Re: Sending Chr(255) to Serial Port
- From: *** Grier
- Re: Sending Chr(255) to Serial Port
- References:
- Re: Sending Chr(255) to Serial Port
- From: *** Grier
- Re: Sending Chr(255) to Serial Port
- From: Vincent
- Re: Sending Chr(255) to Serial Port
- From: *** Grier
- Re: Sending Chr(255) to Serial Port
- Prev by Date: Re: Sending Chr(255) to Serial Port
- Next by Date: Re: Sending Chr(255) to Serial Port
- Previous by thread: Re: Sending Chr(255) to Serial Port
- Next by thread: Re: Sending Chr(255) to Serial Port
- Index(es):