On Wed, 2006-07-12 at 19:52 -0700, Mark Swayne wrote:
Try:

#define XTAL         11059200
#define TICK_PERIOD        20  /* 1/TIME_TICK */
#define RELOAD_VALUE -( XTAL/ (12 * PERIOD) )
                                         Is this a typo ?              ^^^^^^^                  

TL0  = ( unsigned char ) ( RELOAD_VALUE );
TH0  = ( unsigned char ) ( RELOAD_VALUE >> 8 );

or:

#define XTAL             11.0592e6
#define TIME_TICK        50e-3
#define RELOAD_VALUE     -( TIME_TICK * XTAL / 12 )

TL0  = ( unsigned char ) ( RELOAD_VALUE );
TH0  = (unsigned char) ( ((unsigned int) RELOAD_VALUE) >>  8) ;

Both yield:
    mov    _TL0,#0x00
    mov    _TH0,#0x4C

--Mark

CMW Engineering Dept. wrote:
> Dear listers,
>
> I have defined these macros:
>
> ...
> #define XTAL                       11.0592e6
> #define TIME_TICK               50e-3
> #define RELOAD_VALUE     -( TIME_TICK * XTAL / 12 )
> ...
>
>
> When I use statement like this:
>
> ...
> TL0  = ( unsigned char ) ( RELOAD_VALUE );
> TH0  = ( unsigned char ) ( RELOAD_VALUE >> 8 );
> ...
>
> I have error an warning these messages :
> ...
> sys.c:29: error 43: invalid operand for shift operator
> sys.c:29: warning 113: left & right types are
> literal-float,literal-unsigned-char
> sys.c:29: error 47: indirections to different types assignment
> from type 'void'
> to type 'sfr-volatile-unsigned-char'
> ...
>
> How shoud I do the trick in SDCC?
>
> Regards,
> Fahmy
>
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Sdcc-user mailing list
> Sdcc-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sdcc-user
>
>
>   



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user