This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Example UART1 is not giving output

Hi everybody

I have opened this Keil example problem UART1.c and compiled it...with Aduc7026
But this program is not giving output(Like printf("hello") on the serial port). I dont know why?

Thanks in advance

hameed

  • "I have opened this Keil example problem UART1.c ...with Aduc7026"

    What example is that?
    Where did it come from?
    Is it supposed to work with the Aduc7026?

  • From keil code examples

    C:\ADuC_Beta702x\Code\Keil Code Examples\UART\UART1

    #include <ADuC7026.h>

    extern int write (int file, char * ptr, int len); // Functions used to
    extern int getchar (void); // to output data
    extern int putchar(int); // Write character to Serial Port


    int main (void) {
    unsigned char jchar = 0x30;

    char output1[13] = "Hello World\n";

    // Setup tx & rx pins on P1.0 and P1.1
    GP1CON = 0x011;

    // Start setting up UART at 9600bps
    COMCON0 = 0x080; // Setting DLAB
    COMDIV0 = 0x093; // Setting DIV0 and DIV1 to DL calculated
    COMDIV1 = 0x000;
    COMCON0 = 0x007; // Clearing DLAB

    GP4DAT = 0x04000000; // P4.2 configured as an output. LED is turned on

    while(1)
    {

    GP4DAT ^= 0x00040000; // Complement P4.2
    write(0,output1,13); // Output Data
    jchar = getchar(); // RX Data, Single Byte
    write(0,&jchar,1); // Output Rxed Data
    }
    }

    so this one is the program which isnt giving any output.

    Thanks