On Fri, 2013-02-08 at 09:56 -0600, Harley Laue wrote:
> 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

You are right. Stupid me, I forgot to type the extra brackets
while copying :-(


> If this is the answer you're expecting, you'd want to use:
> #define bd4800 (256 - crystal / (192 * 4800))

I did use that and it still does not give me the correct answer.

This is what I have in my header file now :

// #define bd4800 (256 - ((crystal / 100) / (2^0 * 16 * 12 * 48)))
 #define bd4800 (256 - ((crystal / 100) / 9216)) // 244

And that works for now :-)

roelof




------------------------------------------------------------------------------
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