Jump to content
Mark Paanakker

Omit Variable Name When Adressing Bits

Recommended Posts



Currently it is required to state:


intcon1.GIE = 0;


GIE has only been declared as a bit within intcon1, so why can I not simply state

GIE = 0;


Some of the other compilers out there support this (like C5x). This enhancement is not absolutely required, but it makes programming a little more friendly.


Kind regards,

Mark Paanakker

Share this post

Link to post
Share on other sites

if you look in the include files for CC5x, you will see that all the important named bits of the special function registers are declared (mapped) in the include file for each device (since it's different for each)


first off, you'd have to use lowercase gie, not uppercase GIE, since GIE is a value set with a #define.


secondly, I don't think gie has been declared as a bit in intcon1; in the device header file, intcon1 is declared as a volatile char, and GIE is #defined to a value representing which bit it's in... however I don't believe it's defined anywhere that gie is in intcon1 (at least as far as the compiler knows)


you should be able to just add the declarations (at least for the bits of interest) to the appropriate device header file... such as:


bit gie @ intcon1.GIE;


#define gie intcon1.GIE


or, of course, you could add the line at the top of your program instead.


It would be kind of nice to see those declarations in the include files, however I know I sure wouldn't want to be the guy who has to type in hundreds of declarations to each of the over 300 device include files, so personally I don't hold it against them for not adding it, as I'm sure they've got better things to work on :)

Edited by izakdude

Share this post

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...