www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/08/01/06:39:20

From: Jason Green <news AT jgreen4 DOT fsnet DOT co DOT uk>
To: "Mr Big" <esusx AT hotmail DOT com>
Cc: djgpp AT delorie DOT com
Subject: Re: hex bytes thru BCSerio
Date: Wed, 01 Aug 2001 11:38:10 +0100
Message-ID: <epmfmtgussohhuvhaa4jgva6slig77hevj@4ax.com>
References: <F946ANBSQxjyxEFutyA00009b83 AT hotmail DOT com>
In-Reply-To: <F946ANBSQxjyxEFutyA00009b83@hotmail.com>
X-Mailer: Forte Agent 1.7/32.534
MIME-Version: 1.0
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id GAA29444
Reply-To: djgpp AT delorie DOT com

[cc'd back to djgpp AT delorie DOT com]

On Tue, 31 Jul 2001 13:37:46 +0000, you wrote:

> >I haven't used the BCSerio library myself, but it sounds like you are
> >looking for unsigned char.  That gives you the range 0x00-0xff and is,
> >generally speaking, what you want for serial comms.

> hum.  so you're saying instead of sending
> a char as in the ascii characters i normally think of,
> i can probably do something like this:
> 
> unsigned char uc;
> uc = 0xf3
> serial_putchar(uc);

That's what I'm saying, yes.  But also check what serial_putchar() takes
as a parameter.  If it's an unsigned char then use unsigned char, if it's
an int then use int. ;)

There are clear rules about signed/unsigned conversions, which I never
can (be bothered to) remember.  When dealing with bit patterns though,
(0xf3 is an example of that) then usually an unsigned type is best.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019