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 }
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)
Hello again, I use the START_V2.A66 of the Version 4.04 for the XC167CI and the version or the chip works fine now, but not for simulation. I now use the the START167.A66 for the C167CR-LM and everything works fine in the simulation, but the version on the chip doesn't write. If i just initialize the interface and write something, it writes just one character. Does anyone know a solution for that? Thanks Norbert Rastl
Hello Norbert, as far as I remember you need for the XC16x devices at least V4.21 and higher. For the C167CR I unfortunatly do not know the answer. Stefan
Hello, and thanks Stefan. My program now also runs on the XC167CI (with Version 4.01). Can it be that the memory model or my settings for the external memory is wrong? "Medium" ROM: 0x50000 with size 0x3FFFF RAM: 0x100000 with size 0x3FFFF Norbert
I think the memory model will not be the critical point, since you could use different keywords like huge or xhuge ... I think that memory settings are the reason. printf() was crashing my system, only in the case where I adjusted wrong timing for RAM access. BTW: Should not the setting for an XC16x device looks like ROM 0x040000 size 0x3FFF RAM 0x100000 size 0x3FFF Stefan
What would be the better settings for a C167CR-LM? I now use the startup code in version 5.01. And everything runs perfectly in with the simulator but not on the chip. It does nothing. It does not even write a character after initializing the serial interface. Can it be that the On-chip XRAM makes problems?