On Mon, 10 Oct 2005 15:34:09 -0400 you wrote:
>Ralph Hilton wrote:
>
>>>On Sun, 2005-10-09 at 16:46 -0400, Aaron wrote:
>>>
>>>
>>>>if I write:
>>>> putchar ("U") ; transmit ascii U out the serial port
>>>>it throws a "possible loss of precision" warning and actually
>>>>transmits
>>>>ascii 8.
>>>>What am I missing?
>>>>
>>>>
>>
>>"U" is a string.
>>'U' is a character.
>>
>>
>Still trying to remember my C classes from 7 years ago...
>
>Not that it really matters, but how does "U" evaluate to 0x38?
Imagine that you have a 500 character string. It would be horribly inefficient to pass the
500 characters to a function. Instead C passes the address of where the characters are
stored. The address is more than one byte. So the compiler gives a message as it truncates
the address down to one byte. Try doing it twice and I think the byte sent will be
different.
--
Ralph Hilton
http://www.ralphhilton.org
C-Meter: http://www.cmeter.org
FZAOINT http://www.fzaoint.netMessage
Re: [AVR-Chat] codevision putchar()
2005-10-10 by Ralph Hilton
Attachments
- No local attachments were found for this message.