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

XC161CJ ASC1

Hi,

Does anyone has ever see the XC161CJ ASC1 working on the KEIl debug window?

I can not "printf" nothing!

here is changed HELLO:

P3 |= 0x0401; /* SET PORT 3.10 OUTPUT LATCH (TXD) */
DP3 |= 0x0401; /* SET PORT 3.10 DIRECTION CONTROL (TXD OUTPUT) */
DP3 &= 0xF7FD; /* RESET PORT 3.11 DIRECTION CONTROL (RXD INPUT) */
ASC1_TIC = 0x80; /* SET TRANSMIT INTERRUPT FLAG */
ASC1_RIC = 0x00; /* DELETE RECEIVE INTERRUPT FLAG */
ASC1_BG = 0x40; /* SET BAUDRATE TO 9600 BAUD @ 20MHz */
ASC1_CON = 0x8011; /* SET SERIAL MODE */
ALTSEL0P3 |= 0x0C01; /* Configure port pins for serial interface 1 */

printf ("Hello World\n");while(1);


and the putchar:

while (!( ASC1_TIC == (ASC1_TIC | 0x80)) );
ASC1_TIC &= ~0x80;
return (ASC1_TBUF = c);




Any comments will be welcomed of course.

Thanks,
joao

Parents
  • Hi Joao,

    I do a test and you are right.
    It seems the library was created with different code, since I see in disassembly window ASC0_TIR instead ASC0_TIC_IR.

    I had create a own file and translate as object and than link it as I told you,
    the routine is called, but with same result:

    Blocking in the while-Loop waiting for the flag.
    As workaround you may debug with aterminal program ?
    This works as you think with a direct write to ASC1_TBUF.

    For simulator I can not solve it at the moment. Sorry !

    I am back next week. If you have time or solution I will look back for my or your solution.

    Stefan

    Otherwise can you directly ask the support, why the disassemblys are different ?
    May be we can get the code of the printf/putchar for Xc16x devices to rebuild the library.

Reply
  • Hi Joao,

    I do a test and you are right.
    It seems the library was created with different code, since I see in disassembly window ASC0_TIR instead ASC0_TIC_IR.

    I had create a own file and translate as object and than link it as I told you,
    the routine is called, but with same result:

    Blocking in the while-Loop waiting for the flag.
    As workaround you may debug with aterminal program ?
    This works as you think with a direct write to ASC1_TBUF.

    For simulator I can not solve it at the moment. Sorry !

    I am back next week. If you have time or solution I will look back for my or your solution.

    Stefan

    Otherwise can you directly ask the support, why the disassemblys are different ?
    May be we can get the code of the printf/putchar for Xc16x devices to rebuild the library.

Children