On Monday 13 December 2010 21:51:13 Peter Van Epp wrote:
>       Thanks, it looks like that is the best bet, but so far I haven't been
> successfull there either :-). It looks like sdcdb won't run under Cygwin
> and the simulator (which seems to be happy with Cygwin) doesn't produce any
> output to a file when putchar is writing to the UART. Looks like I get to
> put SDCC on a Linux or FreeBSD box and try on there ... If I get something
> working I'll send a howto to the mailing list for the next poor soul :-).
>
> Peter Van Epp

Hello Peter,

the putchar function is target dependant. It is on BSP
support to provide one. There are probably some defaults
provided by SDCC, but I have written this function for my
hardware myself for our targets.

You can use next simple (non IRQ driven) version for simulator

#include <8051.h>

int simple_ser_init(void)
{
  ES=0;
  SCON=0x50;
  PCON|=0x80;   /* Bd = OSC/12/16/(256-TH1) */

 #if 0
  RCLK=0;       /* Timer 1 for serial 0 receiver */
  TCLK=0;       /* Timer 1 for serial 0 transmitter */
  CKCON&=~0x10; /* T1M = 0 => timer 1 clock is f/12 else f/4 */
 #endif
  TR1=0;
  TH1=-5;
  TMOD&=0x0F;
  TMOD|=0x20;
  TR1=1;
  TI=1;
  return 0;
}

void putchar (char c)
{
  static char is_init=0;
  if(!is_init) {
    is_init = 1;
    simple_ser_init();
  }

  while (!TI)
    ;
  TI = 0;
  SBUF = c;
}


It works fine form me in combination with S51.

Best wishes,
                Pavel

--
                Pavel Pisa
    e-mail:     p...@cmp.felk.cvut.cz
    www:        http://cmp.felk.cvut.cz/~pisa
    university: http://dce.fel.cvut.cz/
    company:    http://www.pikron.com/

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to