Dennis,

I have another thought as to what may be the problem.  Do you see any 
linker warnings when you build the sample from Keil with SDCC?

If you use the source from the keil site, the code will not work since 
there is no putchar() function defined in the sdcc stdio.h.  The 
function is declared in stdio.h, but it must be defined by the user 
because different projects will need to handle output very differently.  
For example, for one project, I have a putchar() that can be switched 
between several different serial ports and the SPI.  Each option has a 
different handler.

When you added the serial_IO library, you added a basic serial putchar() 
function. 

--Mark

Dennis Muhlestein wrote:
> Here is something that does work though, if I change the example from keil:
> http://www.keil.com/support/docs/685.htm
>
> to use the include files from sdcc, I start to get the correct functionality:
>
> //-------- working ---------------
> #include <8051.h>
> #include <serial_IO.h>
> #include <stdio.h>
>
> void main (void)
> {
> SCON  = 0x50;                   /* SCON: mode 1, 8-bit UART, enable rcvr    */
> TMOD |= 0x20;                   /* TMOD: timer 1, mode 2, 8-bit reload      */
> TH1   = 0xf3;                   /* TH1:  reload value for 2400 baud         */
> TR1   = 1;                      /* TR1:  timer 1 run                        */
> TI    = 1;                      /* TI:   set TI to send first char of UART  */
>
> while(1)
>   {
>   unsigned char aaa;
>   aaa = getchar();
>   putchar(aaa);
>   }
> }
>
> //-------- end working ------------
>
> So in summary, I think that the fx2 has picky reload values for the timer 
> auto reload at the least.  I also thing there may possibly be some issues 
> with the calculations in the clock and simple examples that come with sdcc.  
> It could be that they are hardware specific issues though.  In the mean time, 
> I'm happy enough using Timer 2 instead of Timer 1.
>
>   


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to