I am using P89V51RD2 for my project I have choosen this IC because it have 1K Ram My programme is compiling but while linking I ma getting following errors.
*** ERROR L127: UNRESOLVED EXTERNAL SYMBOL SYMBOL: ask_disp_key_val MODULE: mc_ad1.obj (MC_AD1) *** ERROR L127: UNRESOLVED EXTERNAL SYMBOL SYMBOL: chk_keys MODULE: mc_ad1.obj (MC_AD1) *** ERROR L127: UNRESOLVED EXTERNAL SYMBOL SYMBOL: chk_test_over MODULE: mc_ad1.obj (MC_AD1) *** ERROR L128: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: ask_disp_key_val MODULE: mc_ad1.obj (MC_AD1) ADDRESS: 10014D3H *** ERROR L128: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: chk_keys MODULE: mc_ad1.obj (MC_AD1) ADDRESS: 10014D9H *** ERROR L128: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: chk_test_over MODULE: mc_ad1.obj (MC_AD1) ADDRESS: 10014DCH *** ERROR L127: UNRESOLVED EXTERNAL SYMBOL SYMBOL: MAIN MODULE: C:\KEIL\C51\LIB\C51L.LIB (?C_INIT) *** ERROR L128: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: MAIN MODULE: C:\KEIL\C51\LIB\C51L.LIB (?C_INIT) ADDRESS: 1000E67H Program Size: data=28.1 xdata=143 const=0 code=6729 Target not created
I am using some of the variables as xdata,I am confused whether this problem is because of xdata? I have done the folloeing changes to startup file also
XDATASTART EQU 0H ; the absolute start-address of XDATA memory XDATALEN EQU 2ffH ; the length of XDATA memory in bytes. AUXR1 DATA 08EH ; add SFR definition STARTUP1: ; enable on-chip xdata RAM ANL AUXR1,#NOT 02H ; AUXR1/Bit 1 (clear to 0 to enable on-chip XRAM)
also my target settings are memory model : large code Rom : Large Use onchip Rom:selected Use onchi XRam :selected Use Multiple DPTR : Selected
Please help me out.
Why large memory model - is it because you want your code to be large and bloated? Why not manually specify what should be separately stored?
Where are your variables. It seems like your project isn't including all source files. Or that you have just said that "somewhere" there will be these symbols but have never given any module the responsibility of owning such symbols. Note declare and define of variables.
symbol names looks like a FUNCTION... if is true... then u might have called these function without including it in the code... or else u had not defined those function before main..
Where the definitions appear relative to main() is of no consequence.
Not 100% correct.
When the definitions are ones that are required by main(), they should appear prior to main().
"When the definitions are ones that are required by main(), they should appear prior to main()."
The declarations would have to appear prior to main() - not necessarily the the definitions.
However, the OP is getting Linker errors - so this has nothing to do with the source code...
not necessarily the the definitions
Yes, which is precisely why I was careful to start my sentence with "When ...".
You said: "When the definitions are ones that are required by main(), they should appear prior to main()"
That's not true.
The definitions of symbols referenced in main() do not have to appear prior to main() - provided that declarations appear prior to main().
But your first response on the matter indicated a level of uncertainty.
It's a good thing, then, that there's no way main() can require any definitions, so this means nothing.
*** ERROR L127: UNRESOLVED EXTERNAL SYMBOL SYMBOL: ask_disp_key_val MODULE: mc_ad1.obj (MC_AD1)
So where is your definition of "ask_disp_key_val"?
*** ERROR L127: UNRESOLVED EXTERNAL SYMBOL SYMBOL: MAIN MODULE: C:\KEIL\C51\LIB\C51L.LIB (?C_INIT)
That looks wrong. You haven't, by any chance, mis-configuresd the case-insensitive linking option?
Well spotted. Give yourself a gold star.
I have included all my definations in a header file called mc_ad1.h
//#include <REGX51.H> #include <REG51F.H> #include <intrins.h> //#include <8052.h> #include "mc_ad1.h" #include "eeprom.h" #include "hw_sw_def.h" //variables for eeprom unsigned char *read_ptr,*write_ptr; extern unsigned char rd_buffer; //variables for serial communication unsigned char ser_in_arr[5],*rec_ptr; unsigned char ser_out_arr[12],*tr_ptr; volatile bit SER_DATA_RDY_F,TR_RDY_F,COMM_OK_F; volatile unsigned int gptimer; unsigned char xdata test_no; //1 unsigned int xdata test_current1,test_current2,time1,time2,time3; //2,4,6,8,10 unsigned int xdata tol_limit_low,tol_limit_high; unsigned int xdata req_count; unsigned int xdata corr_limit_low,corr_limit_high; unsigned int xdata dac_count,pulse_count; unsigned int adc_count; unsigned int dac_count_limit_low,dac_count_limit_high; volatile bit OFL_F,POL_F; unsigned char pol_cntr,ofl_cntr; volatile bit DAC_SET_F,ADC_READY_F,OUT_DATA_F = 0; unsigned int adc_count_arr[5]; unsigned char index = 0; volatile bit CHK_CURRENT_F,NEG_F; unsigned char dac_out_delay_cnt = 0; unsigned char state_no,key_state_no; volatile bit ASK_KEY_F,KEY_HIT_F; unsigned char key_value; volatile bit START_F,TEST_MODE_F; volatile bit VIEW_ONLY_F,DISP_TIME_F; unsigned char xdata restore_disp_no; unsigned char set_pointer,blink_ptr; volatile bit SETT_ERR_F; unsigned char temp[6]; unsigned int xdata time = 0; unsigned char xdata time_counter = 0,time_mode = 1; volatile bit START_TIME_F,NOTRIP_F,TRIP_F,DISP_UPDATE_F,DISP_CURRENT_F,CERR_F; void main(void) { init_timer0(); init_timer1(); init_serport(); read_from_eeprom(); chk_data(); // test_no = 1; // default_set(); delay_100_ms(2); init_int0(); init_int1(); key_state_no = INIT; state_no = INIT_TEST; reset_dac_out(); disp_scr(); while(1) { /*if(ADC_READY_F) { ADC_READY_F = 0; adc_read(); // current = calc_test_current(adc_count); disp_current(adc_count); delay_100_ms(5); TEST1 = ~TEST1; }*/ if(ASK_KEY_F) { // P1^5 ^= 0x01; ASK_KEY_F = 0; ask_disp_key_val(); } if(KEY_HIT_F) chk_keys(); chk_test_over(); } //remaining code(called functions below) }
I have defined all the fuctions ,I am new to keil preeviously using sdcc compiler.I have tried to remove syntactical errors,but can't understand meaning of these errors.
check meanings of error messages in the link... http://www.keil.com/support/man/docs/c51/c51_errors.htm
I hope you haven't - that would certainly be A Bad Thing.
But I guess you really mean that you've included declarations in your header...?
While declarations are necessary for the file to compiler, they are not sufficient for the whole project to link - you must also have the definitions somewhere.
See: c-faq.com/.../decldef.html
"I have defined all the fuctions"
No, the message clearly tells you that you have not defined them - or, at least, not in any place that the linker can find...
"I am new to keil preeviously using sdcc compiler"
This has nothing specifically to do with Keil nor SDCC - it is standard 'C' stuff