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.
The C code is:
#pragma SRC #include<Reg936.h> #define uchar unsigned char #define uint unsigned int extern uchar AA1; extern uchar a_func(uchar) void main() { unsigned char ab,acd; AA1=0xff; P0M1=0xff; P0M2=0xff; ab=1; acd=128; while(1) { if(ab==128) { P0=~acd; ab=128; acd/=2; a_func(acd); } if(acd==128) { P0=~ab; acd=128; ab*=2; a_func(ab/2); } if((ab==128)&&(acd==1)) { ab=1; acd=128; } } }
when i press the "build target",and disappear the error:
C51 FATAL-ERROR - ACTION: PARSING INVOKE-/#PRAGMA-LINE LINE: #pragma SRC ERROR: RESPECIFIED OR CONFLICTING CONTROL
how to deal with the error?
Sounds like you've both checked the 'Generate SRC File' option in uVsion and put #pragma SRC in the source file itself.
You need to do one or the other but not both!
In fact, since the code you show doesn't contain any ASM/ENDASM section, you might as well remove them both!
http://www.keil.com/support/man/docs/c51/c51_src.htm
Yes,the ASM section in another file,and the name is mixx.asm,the code is:
NAME MIX ?PR?_a_func?MIX SEGMENT CODE ?DT?_a_func?MIX SEGMENT DATA OVERLAYABLE ?DT?MIX SEGMENT DATA PUBLIC AA1 PUBLIC ?_a_func?BYTE PUBLIC _a_func RSEG ?DT?_a_func?MIX ?_a_func?BYTE: BB1:DS 1 RSEG ?DT?MIX AA1:DS 1 RSEG ?PR?_a_func?MIX _a_func: mov a,AA1 az:mov r6,#40 cd:mov r5,#0 djnz r5,$ djnz r6,cd djnz r7,az ret end
When I checke 'Generate SRC File' ,and also appear the error:
I want to know which settings I should do.Is there any example?
"I want to know which settings I should do."
You have a 'C' file, and you have a separate Assembler file - therefore you do not need to use the SRC directive at all!
Remove both the 'Generate SRC File' option in uVsion and the #pragma SRC in the source file itself.
"Is there any example?"
See: http://www.keil.com/download/docs/53.asp
Thank you very much! I have learned one of the ways to call .asm file in C,but do nOt know how about it. First,I wrote two .C files,and the one to be subroutine with only stating variables.... .. Thanks for your helps!