We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I want to use C mixed with assembler. I wrote the following experimental program: void main(void){ char i,a[20]; for(i=0;i<20;i++)a[i]=i; #pragma ASM MOV A,#29H MOV R2,A ..etc.. #pragma ENDASM } When building this program together with Startup.a51, the following linker warning appears WARNING L1: UNRESOLVED EXTERNAL SYMBOL SYMBOL: ?C_START MODULE: .\Startup.obj (?C_STARTUP) WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: ?C_START MODULE: .\Startup.obj (?C_STARTUP) ADDRESS: 2029H After adding some other statements the program became this: #include <stdio.h> #include "setUpSerPort.h" void main(void){ char i,a[20]; for(i=0;i<20;i++)a[i]=i; setUpSerialPort(); printf("program running"); #pragma ASM MOV A,#29H MOV R2,A ..etc.. #pragma ENDASM } file setUpSerialPort.h contains #ifndef setUpSerPort_h #define setUpSerPort_h void setUpSerialPort(); #endif file setUpSerialPort. c contains void setUpSerialPort(void){ #ifndef MONITOR51 SCON = 0x50; TMOD = 0x20; TH1 = 221; TR1 = 1; TI = 1; #endif } When building this project thelinker warnings have gone! But why?? With regards.