main() { char szOut[100]; int nYear,nMonth,nDate,nHour,nMinute,nSecond,nOldSec = 0; rtc_init(); set_date_time(2005,6,3,10,58,55); while(1) { get_date_time(&nYear,&nMonth,&nDate,&nHour,&nMinute,&nSecond); memset(szOut,0,sizeof(szOut)); if (nOldSec != nSecond) { nOldSec = nSecond; goto_xy(1,0); memset(szOut,0,sizeof(szOut)); sprintf(szOut,"%04d/%02d/%02d %02d:%02d:%02d",nYear,nMonth,nDate,nHour,nMinute,nSecond); printf(szOut); } } date time from rtc is ok,but sprintf sometimes ok sometime error(printf result is "2005/06/03 32423423/59/02","2005/06/03 10/324234/384083" ).I selected the ups3354dv from the device database. please help me? thanks.
A.W. Neil,thank you for your advise。 I think the problem may be result from the memory mapping。 here is my settings: Memory Model:Large code ram size:Large 64k program Off-chip code memory:0x0000~0xFFFF off-chip xdata memory:0x3000~0x6000 not selected code banking
can you give me some advise about memory mapping.
"I think the problem may be result from the memory mapping" What makes you think that?
"What makes you think that? " that is a big array in my application,while i cutted down the array the problem disapplear. but i don't konw how or why it occure. I remember i had seen this problem in the discussion forum before. FYI: http://www.keil.com/forum/docs/thread601.asp http://www.keil.com/forum/docs/thread3002.asp