Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

How to acces bits of pic14 ports

Jorus
2006-09-27
2013-03-12
  • Jorus
    Jorus
    2006-09-27

    Hi all,

    I can't manage to access bits of PORTA of my 16f84a (for example) separatly. Iwould like to do something like that :
    PORTA.RA0 = 1;
    PORTA.RA0 = 0;
    or :
    RA1 =1;
    RA1=0;

    I think that it is something stupid but i can't find what. :-(

    Thanks a lot in advance
    Jorus

     
    • Robas Teodor
      Robas Teodor
      2006-09-27

      Hello,

      I had the same problem and I need to recompile sdcc with a modified version of /device/include/pic/pic16f84.h
      If you want to recompile, you can find this files (for 84 and 84a) here http://www.tadelos.ro/suport/
      Then you can simply do RA0 = 1 in your code ....

       
      • Jorus
        Jorus
        2006-09-29

        Hello,

        rteodor, I tried your solution but I'm having the following errors :
        error: missing definition for symbol "_PORTA_bits"
        error: missing definition for symbol "_PORTA_bits"

        I recompile sdcc. I think that I must include something but I can't find what.

        Thanks in advance
        Bye
        Jorus

         
        • Jorus
          Jorus
          2006-10-02

          Hi,

          It works with your help. Thanks all.
          But, I have noticed that when I access to one bit of a port, for example RA2, the bank is not selected correctly. So I must init TRISA before PORTA like :
          TRISA = 0;
          PORTA = 0;

          Thanks again
          Bye
          Jorus

           
    • Jorus
      Jorus
      2006-09-28

      Hi !

      Thanks a lot, it is exactly what I need !

      Arf. I was turning around this solution without find it...

      Thanks again
      bye
      Jorus

       
    • Jorus
      Jorus
      2006-09-29

      Re,

      Hoho ! I think that I understand why it is necessary to recompile sdcc. The PORTA_bits is extern in your sdcc/devive/include/pic/pic16f84a.h
      So it must be defined in sdcc/devive/lib/pic/libdev/pic16f84a.c

      But if it is not specified extern in the .h, it must work. I'll try this tonight after work.

      Jorus

       
    • Maarten Brock
      Maarten Brock
      2006-10-01