From: Royce & S. P. <be...@im...> - 2002-04-11 07:51:48
|
Hi, This means that I have to compile my max187.c file again for every project? Also do I need different max187_def.h file for each project? This will defeat my purpose as I wanted to make my max187 function a library function, i.e permanently define the bits as global in the max187 module & initialise them with the required port bits in the main C file. Again, can be this done? Thanks to all, --Royce. ----- Original Message ----- From: Rod Boyce <rod...@st...> To: SDCC list <sdc...@li...> Sent: Thursday, April 11, 2002 1:13 AM Subject: RE: [Sdcc-user] How to define port lines as extern? > Have you not heard of header files this is one of their many exact purposes > I have done this on many occasion. You define in the header file what port > pins to use how else does the linker know where to find the port pins for > that module. I have even used a separate include file for definable items > like this when the project required it. > > Example: > > File max187_def.h > > #ifndef MAX187_DEF_H > #define MAX187_DEF_H > > #define P3_5 cs_adc > #define P3_6 clk_adc > #define P3_7 data_adc > > #endif > part of file max187.c > > #include "max187_def.h" > > > It really is that simple. > > > Regards, > Rod Boyce. > > -----Original Message----- > From: Royce & Sharal Pereira [mailto:be...@im...] > Sent: Thursday, 11 April 2002 12:02 a.m. > To: SDCC list > Subject: Re: [Sdcc-user] How to define port lines as extern? > > Hi, > Even after doing: > #define P3_5 cs_adc > in my main C file, the linker still says > " undefined global "_cs_adc" in module max187" > > Right now I'm cut-pasting the max187 function in my main C file for every > project, which I want to avoid! > > Is there a way? > > Thanks, > --Royce. > > ----- Original Message ----- > From: Gernot.Fink <ger...@ne...> > To: SDCC list <sdc...@li...> > Sent: Tuesday, April 09, 2002 8:01 PM > Subject: Re: [Sdcc-user] How to define port lines as extern? > > > > On Tue, 09 Apr 2002, you wrote: > > > > > >extern bit cs_adc, ck_adc, dat_adc; (also tried sbit). > > > > > >In my main C file I tried: > > > > > >sbit at P3_5 cs_adc; & got " constant expected variable found". > > > > > >Tried: sbit at 0xb5 cs_adc; > > > > > > You can use : > > > > #define cs_adc P3_5 > > > > The Variable P3_5 is in the headerfile for your uc declared. > > > > -- > > MFG Gernot > > > > _______________________________________________ > > Sdcc-user mailing list > > Sdc...@li... > > https://lists.sourceforge.net/lists/listinfo/sdcc-user > > > _______________________________________________ > Sdcc-user mailing list > Sdc...@li... > https://lists.sourceforge.net/lists/listinfo/sdcc-user > > _______________________________________________ > Sdcc-user mailing list > Sdc...@li... > https://lists.sourceforge.net/lists/listinfo/sdcc-user |