Mail Archives: djgpp/2001/08/01/06:39:20
[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 -