TL;DR

On Fri, Feb 8, 2013 at 9:08 AM, roelof 't Hooft <roel...@itholland.nl>wrote:

> I am using the following in a header file :
>
> #define crystal 11059200
> #define bd4800 (256 - crystal / 192 * 4800)
>
> Here the result is 0xef854100
>

Based on the order of precidence, this looks like the right answer to me:
11059200/192 = 57600
57600*4800 = 276480000
256-276480000=0xFFFFFFFFEF854100


>
> #define crystal 11059200
> #define bd4800 (256 - (crystal / 921600))
>
> And here the (correct) result is 0xf4
>

If this is the answer you're expecting, you'd want to use:
#define bd4800 (256 - crystal / (192 * 4800))
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to