Menu

#54 PORTAbits type definition only works with PIC16 port?

closed
nobody
None
5
2006-11-23
2006-11-23
marco_gaio
No

I tried SDCC version 6.0 both with the pic14 and the pic16 port. However with the pic16 port(i.e. for a 18f452, including pic18fregs.h) I can use e.g. PORTAbits.RA0 to set/read that . Instead, with pic14 the port(e.g. 16f84a including pic16regs.h) I cannot use such definition of PORTAbits, since the compiler couln't recognize the structure PORTAbits and I can't neither declare it by using the _at keyword to locate such structure at address 5.
Does somebody can help me?
Thanks, Regards

Discussion

  • Raphael Neider

    Raphael Neider - 2006-11-23

    Logged In: YES
    user_id=1115835
    Originator: NO

    Not sure where your problem is:
    The header file for the pic16f84a.h tells you there is a struct PORTA_bits defined (beware the underscore, though); and there are aliases (macros, defines) set up for you to use RA0 instead of PORTA_bits.RA0 (in fact, the latter will yield syntax errors unless you #undef RA0 beforehand).

    If your pic16f84a.h differs in that these are not defined, just grab a more recent version (nightly build, strongly recommended) and try again. Or download just the required header file and library source (device/lib/pic/libdev/pic16f84a.c) and link them into your project.

    Please close this request if your problem is solved.

    HTH,
    Raphael

    BTW: You cannot define objects at locations already used in other modules; so all SFR related declarations should go into the pic16fXXX.[ch] files; you may want to override the library versions with modified ones in your project tree. In this case, just make sure to have -I. before the true library path in your sdcc command line.

     
  • marco_gaio

    marco_gaio - 2006-11-23

    Logged In: YES
    user_id=1652313
    Originator: YES

    Thanks Raphael for yor advice, I'm sure I haven't got the right header for the 16f84a, since it lacks the PORTA_bits and RA0 definitions.
    Please consider this request as close, I will look for the updated version.
    Thanks again and Regards
    Marco

     
  • Raphael Neider

    Raphael Neider - 2006-11-23
    • status: open --> closed
     
  • marco_gaio

    marco_gaio - 2006-11-24

    Logged In: YES
    user_id=1652313
    Originator: YES

    Please see tracking item 1602242 on the same topic.

     

Log in to post a comment.