> 
> Message: 7
> Date: Tue,  4 Dec 2007 13:56:04 +0100
> From: [EMAIL PROTECTED]
> Subject: Re: [Sdcc-user] PORTA and PORTB bit structures missing for
>       pic16f88
> To: [EMAIL PROTECTED], [email protected]
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=ISO-8859-1
> 
> You were right I was using an old version (actually the one provided by my 
> distro, Ubuntu), so switching to a newer version solve the problem, thanks. 
> (sorry for not having checked).
> 
> But there is still a probleme in the new version (December 4, 2007 nigthly 
> build), in pic16f88.h there is :
> 
> // ----- PORTA bits --------------------
> typedef union {
>   struct {
>     unsigned char RA0:1;
>     unsigned char RA1:1;
>     unsigned char RA2:1;
>     unsigned char RA3:1;
>     unsigned char RA4:1;
>     unsigned char RA5:1;
>     unsigned char :1;
>     unsigned char :1;
>   };
> } __PORTA_bits_t;
> extern volatile __PORTA_bits_t __at(PORTA_ADDR) PORTA_bits;
> 
> #ifndef NO_BIT_DEFINES
> #define RA0                  PORTA_bits.RA0
> #define RA1                  PORTA_bits.RA1
> #define RA2                  PORTA_bits.RA2
> #define RA3                  PORTA_bits.RA3
> #define RA4                  PORTA_bits.RA4
> #define RA5                  PORTA_bits.RA5
> #endif /* NO_BIT_DEFINES */
> 
> 
> Why are RA6 and RA7 not defined?
> They can be used as regular io so defining them does no harm (and helps 
> someone who want's to use them).
> 
> I don't use those pins right now, so thanks for your help.
> Take care
> 
> 
>> Date: Mon, 03 Dec 2007 18:05:50 +0100
>> De: Raphael Neider <[EMAIL PROTECTED]>
>> A: [email protected], [EMAIL PROTECTED]
>> Sujet: Re: [Sdcc-user] PORTA and PORTB bit structures missing for pic16f88
>>
>> Without your source code and version numbers this is kinda hard to
>> debug; lets try anyways...
>>
>> (1) Probably you are simply using an ancient version of SDCC, 2.6.0?
>>    Use sdcc -v to tell.
>> (2) Do you #include "pic14regs.h" or at least #include "pic16f88.h"?
>>    If you did, recent SDCC versions should have complained about
>>    redefining PORTA_bits...
>> (3) How do you compile and link? You must link against libsdcc.lib and
>>    pic16f88.lib, preferably by mimicking the way SDCC calls the linker
>>    (see output of 'sdcc -mpic14 -p16f88 main.c -V' for some
>>    self-contained source file that includes the main() routine.
>>
>>> missing definition for symbol "_PORTA_bits", required by "led.o"
>> This indicates that you are not linking with pic16f88.lib (or that your
>> library is outdated).
>>
>>> So I edited my main c file (main.c) and added :
>>> volatile __PORTA_bits_t __at(PORTA_ADDR) PORTA_bits;
>>>
>>> Now I get this error :
>>> multiple sections using address 0x5
>> Address 0x05 is defined in the library to be PORTA (I guess). This
>> indicates that you are linking with pic16f88.lib but are using an
>> outdated SDCC version. Grab and install a snapshot of the 2.7.4 release
>> and try again.
>>
>>> I really don't know how to do this #define so I can simply test and set a 
>>> pin.
>> You cannot, unless you take a different approach:
>> #define SET(reg,bit) (reg) |= (1<<(bit))
>> #define CLR(reg,bit) (reg) &= ~(1<<(bit))
>>
>> #define LED1 PORTA,0
>> #define LED2 PORTA,2
>>
>> void myfunc (void) {
>>  SET(LED1); CLR(LED2);
>> }
>>
>>> I looked and the pic16f88.h and pic16f88.c in the share/sdcc/ folder
>>> and changed thing but still no improvement. I also found a pic16f88.lib
>>> which I think should be modify (re-compiled) to add the PORTA_bits
>>> structure, but I don't know how to do it.
>> Conceptually the right approach, but needless, as this is already done
>> in up-to-date versions.
>>
>> Regards,
>> Raphael
>>
> 
> 

Hello,
I use SDCC : 
mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.7.0 
#4818 (May 31 2007) (UNIX)

I can use RBO, it's in the /usr/local/share/sdcc/include/pic/pic16f88.h

line 714
extern volatile __PORTB_bits_t __at(PORTB_ADDR) PORTB_bits;

#define RB0                  PORTB_bits.RB0
#define RB1                  PORTB_bits.RB1
#define RB2                  PORTB_bits.RB2
#define RB3                  PORTB_bits.RB3
#define RB4                  PORTB_bits.RB4
#define RB5                  PORTB_bits.RB5
#define RB6                  PORTB_bits.RB6
#define RB7                  PORTB_bits.RB7

the same with RAx

I work with Debian Etch, the 2.6.0 in /usr/ and the 2.7.0 in the usr/local/

Pierre Launay


-------------------------------------------------------------------------
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to