2
\$\begingroup\$

I am using PIC18F45K22 and MPLAB XC8. Recently I stumbled upon something while reading ADCON0 register. A particular bit in the register, GO/DONE has many representations while I try bit addressing it in xc8 (something like ADCON0bits.GO_NotDone). These are Go, Done, Go/Done, Go_notDone, Go_nDone.

My question is why are so many representations required for the same bit? It could have simply been something like GO_NotDone. Am I missing something in my understanding? Any insights are welcome, thanks.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

I would like to respond to your question as why Microchip has multiple names for bits in some of the Special Function Register.

I have been using Microchip controller since the PIC16C54 was introduced, or about 25 years. At first the documentation was written by engineers and they were not too concerned about consistency with naming registers or bits.

The result is that there is a legacy code base that uses variant names. To allow that code to build when Microchip updated the assemblers or compilers aliases were injected for variant names of registers and bits. I doubt that the names were added just to make C code more readable.

I admit that this is opinion based on years of observation and not on any statements from Microchip.

Should anyone have direct knowledge I, for one, would appreciate being told I am wrong.

\$\endgroup\$
1
  • \$\begingroup\$ You are totally right! It's jus to be compatible with the old stuff. \$\endgroup\$
    – Mike
    Commented Oct 26, 2018 at 7:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.