From 560a28ef44da302a3affced2ae64705da8f74400 Mon Sep 17 00:00:00 2001 From: bernhardheld Date: Thu, 3 Jan 2002 23:15:16 +0000 Subject: [PATCH] correct setup of timer / UART git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1766 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 4 ++++ support/regression/ports/mcs51/support.c | 23 ++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5ddac3e9..d719f201 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2001-01-04 Bernhard Held + + * support/regression/ports/mcs51/support.c: correct setup of timer / UART + 2001-01-03 Bernhard Held * src/SDCCsymt.c (processFuncArgs): fix #498307 by Johan diff --git a/support/regression/ports/mcs51/support.c b/support/regression/ports/mcs51/support.c index ce445113..5ef3dade 100644 --- a/support/regression/ports/mcs51/support.c +++ b/support/regression/ports/mcs51/support.c @@ -1,14 +1,35 @@ -// #define MICROCONTROLLER_8051 +// #define MICROCONTROLLER_8051 #include +unsigned char +_sdcc_external_startup (void) +{ + /* copied from device/examples/mcs51/simple2/hi.c */ + PCON = 0x80; /* power control byte, set SMOD bit for serial port */ + SCON = 0x40; /* serial control byte, mode 1, RI _NOT_ active */ + TMOD = 0x21; /* timer control mode, byte operation */ + TCON = 0; /* timer control register, byte operation */ + + TH1 = 0xFA; /* serial reload value, 9,600 baud at 11.0952Mhz */ + TR1 = 1; /* start serial timer */ + + TI = 1; /* enable transmission of first byte */ + return 0; +} + void _putchar (char c) { + while (!TI) + ; SBUF = c; + TI = 0; } void _exitEmu (void) { + while (!TI) /* wait for the last character to be transmitted */ + ; /* before hitting the breakpoint */ * (char idata *) 0 = * (char xdata *) 0x7654; } -- 2.47.2