• AVR Freaks

Custom Name

Author
K3PTO
Starting Member
  • Total Posts : 58
  • Reward points : 0
  • Joined: 2014/07/06 13:09:14
  • Location: Camdenton, mo
  • Status: offline
2018/10/23 17:34:21 (permalink)
0

Custom Name

I am just starting to use MCC so I may be doing something wrong.  All of the pins in the Pin Module allow me to enter a Custom Name EXCEPT the one I want to use for a PWM output - OC2.  Any ideas?  I am using MPLABX 5.05, MCC 3.66 and Windows 10pro.
#1

3 Replies Related Threads

    davekw7x
    Entropy++
    • Total Posts : 1827
    • Reward points : 0
    • Joined: 2012/01/16 12:01:07
    • Location: Second star on the right, straight on till morning
    • Status: offline
    Re: Custom Name 2018/10/24 09:14:40 (permalink)
    0
    k3pto
    ...All of the pins in the Pin Module allow me to enter a Custom Name EXCEPT the one I want to use for a PWM output - OC2.  Any ideas?...

    My take on it:
    The "Custom Name" feature of the Pin Module setup allows user-friendly notation within a program.  For example, the ability to rename IO_RA7 to LED1 means that MCC generates macros so that my program can have stuff like LED1_Toggle() rather than IO_RA7_Toggle()
    Then, if I decide to assign RA8 to LED1 instead of RA7 in the MCC setup, I don't have to change the source code.  That is, the same old LED1_Toggle() now wiggles the newly assigned pin.  In my opinion, and with my modus operandi, that's a Good Thing
     
    Now, for example, in my PIC24FJ256GA702 project I assign Pin RC7 to the OC2 function.  The question is: where in your program code would you refer to the OC2 pin in such a way that renaming it in MCC would come into play?  Not to belabor the point: Where in the source code would you refer to the OC2 pin by name?
     
    Bottom line: If I wanted to use a particular pin, say RC7, as a GPIO output in one part of the program (with  the OC2 module disabled) and use it as the OC2 output in another part of the program (with the OC2 module enabled), then I would (probably) assign that pin to OC2 in MCC and put my own code (maybe involving macros that I define for the purpose) to initialize and change output values outside MCC.  I could call it LED2, but I would (probably) call it OC2_LED or some such thing as a reminder to myself that the pin is also used for other things.
     
    Regards,

    Dave
    post edited by davekw7x - 2018/10/24 11:02:40

    Sometimes I just can't help myself...
    #2
    K3PTO
    Starting Member
    • Total Posts : 58
    • Reward points : 0
    • Joined: 2014/07/06 13:09:14
    • Location: Camdenton, mo
    • Status: offline
    Re: Custom Name 2018/10/24 13:18:48 (permalink)
    0
    Hi Dave,
    Thank  you for your thoughtful reply.  I did not consider how I would use the Custom Name, but now that I think about it, I cannot think of why I would need itpink: pink.
     
    #3
    davekw7x
    Entropy++
    • Total Posts : 1827
    • Reward points : 0
    • Joined: 2012/01/16 12:01:07
    • Location: Second star on the right, straight on till morning
    • Status: offline
    Re: Custom Name 2018/10/24 13:20:27 (permalink)
    0
    k3pto
    ,,,
    Thank  you ...



    It was my pleasure.
     
    73,
     
    Dave

    Sometimes I just can't help myself...
    #4
    Jump to:
    © 2019 APG vNext Commercial Version 4.5