I have read http://www.keil.com/forum/1854/how-to-use-extern-sbit-declare/
My problem is same. Using "extern sbit" works as mentioned in above post for small project.
My project has more then 10 files.
Now same solution do not work.
Therefore, the reason must be something else!
"Now same solution do not work."
What, exactly, do you mean by "do not work"?
What, exactly, fails?
How, exactly, does it fail?
How do I upload my project? zip file is approx 30K
This site does not support uploads.
But you should be able to answer the questions that I asked!
Again, it has nothing to do with the number of files - so try to reproduce the problem in the smallest possible project.
Also note that the thread you cited rambles-on about a number of issues - so saying that you have the "same" problem is not really meaningful!
Again:
Note that you can copy-&-paste error messages from the uVision Output window...
Test_Main.C ------------ #include "c8051F060.h"
extern void toggle_Ext_IP_EN_bit(void); extern void toggle_PF_En_bit(void); extern void toggle_Sup_Ext_IP_EN_bit(void); extern void toggle_Auto_Manual_bit(void); extern void toggle_Machine_Type_bit(void);
unsigned bdata En_Bits = 0;
sbit Ext_IP_EN_bit = En_Bits^0; sbit PF_En_bit = En_Bits^1; sbit Sup_Ext_IP_EN_bit = En_Bits^2; sbit Auto_Manual_bit = En_Bits^3; sbit Machine_Type_bit = En_Bits^4; sbit PF_Auto_Manual_bit = En_Bits^5; sbit Over_Load_Pf_En_bit = En_Bits^6;
sbit On_Pin = P0 ^ 0; sbit Off_Pin = P0 ^ 0;
void main(void) { WDTCN = 0xDE; WDTCN = 0xAD; while(1) { toggle_Ext_IP_EN_bit(); toggle_PF_En_bit(); toggle_Sup_Ext_IP_EN_bit(); toggle_Machine_Type_bit(); } } -------------------------------------------------------------------- Header file - Main.h #include <c8051F060.h>
extern bdata En_Bits;
extern bit Ext_IP_EN_bit, PF_En_bit, Sup_Ext_IP_EN_bit, Auto_Manual_bit, Machine_Type_bit, PF_Auto_Manual_bit, Over_Load_Pf_En_bit, On_Pin, Off_Pin; ----------------------------------------- Sup_Ext_IP.C #include "Main.h"
void toggle_Sup_Ext_IP_EN_bit(void) { Sup_Ext_IP_EN_bit = ~Sup_Ext_IP_EN_bit; On_Pin = On_Pin; Off_Pin = Off_Pin; } ------------------------------------------------------------------------------ Build target 'Target 1' compiling Test_Main.C... compiling Sup_Ext_IP.C... compiling Ext_IP.C... compiling Machine_Type.C... compiling PF.C... linking... *** WARNING L1: UNRESOLVED EXTERNAL SYMBOL SYMBOL: OFF_PIN MODULE: Sup_Ext_IP.obj (SUP_EXT_IP) *** WARNING L1: UNRESOLVED EXTERNAL SYMBOL SYMBOL: ON_PIN MODULE: Sup_Ext_IP.obj (SUP_EXT_IP) *** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: ON_PIN MODULE: Sup_Ext_IP.obj (SUP_EXT_IP) ADDRESS: 00A6H *** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: ON_PIN MODULE: Sup_Ext_IP.obj (SUP_EXT_IP) ADDRESS: 00A8H *** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: OFF_PIN MODULE: Sup_Ext_IP.obj (SUP_EXT_IP) ADDRESS: 00AAH *** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: OFF_PIN MODULE: Sup_Ext_IP.obj (SUP_EXT_IP) ADDRESS: 00ACH Program Size: data=11.0 xdata=0 code=188 "Test_Main" - 0 Error(s), 6 Warning(s).
Sorry Sir
I refered your http://www.keil.com/support/docs/1317.htm and found solution. I made a HW.h and included wherever needed.
Now 0 Errors and 0 warning!!
Thanks
Warm regards Vimal
Vimal, I have some advice.
You should comment your code (NO code is truly self commenting).
The other bit of advice is space out your code, there is no prize for compactness of code that I am aware of other than this --> http://www.ioccc.org/
Thirdly there is < pre > < /pre > to place source into for people to read. Very helpful to the people trying to help you.
Happy coding!
Stephen
man i realy like your code. but when you fix the small bug error you send it to us. we need more good examples like it.
Thanks a lot for guidance. Unfortunately, actual code is a very large code. I had generated this sample code. As soon as I realized mistake, I erased it. Sorry for that.
Thanks again