Am 07.06.20 um 22:22 schrieb Philipp Klaus Krause:
> Am 07.06.20 um 21:41 schrieb Eric Rullens:
>> Just a wild guess after browsing the manual: the UART pins can be selected
>> via S1_S[1:0] in P_SW1, and this setting does not seem to have a default?
>>
>>  Eric
> 
> Interesting find, but when I try explicitly setting it to 0, it it
> doesn't make a difference.
> 
> Philipp

Looks like I can't get the UART to work on IAP15W4K58S4 either, tried
the following there (the IAP15W4K58S4 is being calibrated to 24 Mhz):

#include <stdio.h>

__sfr __at(0x88) TCON;
__sfr __at(0x89) TMOD;
__sfr __at(0x8b) TL1;
__sfr __at(0x8d) TH1;

__sfr __at(0x98) SCON;
__sfr __at(0x99) SBUF;

int putchar(int c)
{
        while(!(SCON & 0x02));
        SCON &= ~0x02;
        SBUF = c;
        return (c);
}

void main(void)
{
        unsigned long int i = 0;

        // Configure UART for 9600 baud, 8 data bits, 1 stop bit.
        TMOD = 0x20;
        SCON = 0x40;
        TH1 = 256 - 24.0 * 1000 * 1000 / 12 / 32 / 9600 + 0.5;
        TCON |= 0x40;
        SCON |= 0x02;                           // Tell putchar() the UART is 
ready to send.

        for(;;)
        {
                printf("Hello World!\n");
                for(i = 0; i < 147456; i++); // Sleep
        }
}

Philipp


_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to