Re: typecasting on macro

"Larry Barello" <[email protected]> Fri, 23 May 2003 17:57:40 -0700
Newsgroups gmane.comp.hardware.avr.general
Message-ID <051701c3218f$7bcda320$6400a8c0@larryba>
Try telling the compiler that 4000000 is a long e.g.
#define MCU_CLOCK 4000000L

Your clue is the compiler warning: The 4E6 is being truncated to 16 bits and looks like
a large negative number...

----- Original Message -----
From: "M. Fahmy F." <[email protected]>
To: <[email protected]>; <[email protected]>
Sent: Friday, May 23, 2003 5:47 PM
Subject: [AVR-Chat] typecasting on macro


> Hi all,
>
> I need your time to tell me how come this does not work, meaning that I
> can't get it work with HyperTerminal.
> I defined macro THE_VALUE in my header file for initialising UBRRH and UBRRL
> registers.
> At my C source (line 24-25) I tried to split THE_VALUE and initiate UBRRH
> and UBRRL.
> By then it should be UBRRH = 0 and UBRRL = 12, BUT......
> in the code listing the compiler tried to initiate UBRRL with 60 (look at
> label .LM8).....
> and UBRRH with -1 (look at label .LM9).
>
> I guess it is the typecasting that generate warning at messege output.
>
> Any comment?
>