We help IT Professionals succeed at work.

Sending bytes using the serial com-port

Lillan061397
Lillan061397 asked
on
Medium Priority
264 Views
Last Modified: 2010-04-03
Hi!
I need help whith sending bytes to the serial com-port. Sending Char is no problem, but I want to send Byte. Whith Byte I meen that I want to be able to send 123 in one byte and not in three. How do I do that? I'm using Delphi 2 and overlapped structure on the port, if need to know that.
Comment
Watch Question

Commented:
I'm not sure this is what your wanting, but try this:

aByte := StrToIntDef('123', 0);
{.. Send the Byte ..}

Where aByte = aByte:Byte;
and '123' is the string you want converted to a byte.

I have only tested this in Delphi 3.0 I'm not at my D2 Machine.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
I want aByte to have the value 123. 123 is an integer and not a string. It's very important that the value is correct.

Thanks!

Author

Commented:
It works!!! Thanks! The ASCII tabel I first had was wrong, so I thought that it didn't work.

Linda.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.