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

printf doesn't work

Hello,

I've a project with two targets, the XC167CI and the C167CR-LM. But if I want the program to print some information with printf, it doesn't work (flash version and sumulationon the XC167CI and the flash version for the C167...).

The initialization must be correct (I hope so)

/* defines for XC167CI */
#define S0TIC ASC0_TIC
#define S0RIC ASC0_RIC
#define S0BG  ASC0_BG
#define S0CON  ASC0_CON


void initSerial(void) {
  P3  |= 0x0400;
  DP3 |= 0x0400;
  DP3 &= 0xF7FF;
  S0TIC = 0x80;
  S0RIC = 0x00;
  #ifdef XC167
    S0BG = 0x81;
  #endif
  #ifdef C167
    S0BG = 0x40;
  #endif
  S0CON = 0x8011;
  #ifdef XC167
    ALTSEL0P3 |= 0x0C00;
  #endif
}

Moreover I've changed the startup code with
SSTSZ   EQU     0x50
...
USTSZ   EQU     0x50
...
MOV     STKUN,#0FFFEH  ; AVOID STKUN TRAP
MOV      STKOV,#0H     ; AVOID STKOV TRAP
   ;MOV     STKUN,#SOF (_TOS)
   ;MOV     STKOV,#SOF (_BOS+6*2)
   ;MOV     SP,#SOF (_TOS)
   ;MOV     SPSEG,#SEG (_TOS)

Where can be the bug? I already tried so much but can't find the problem.

Thank You
Norbert Rastl

PS.: memory model = "MEDIUM"

0