NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » PORTD|=_BV(1);
June 06, 2011 by Snoogie2563 |
Hi all, Can someone explain to me what the line of code I have placed in the subject line means. Specifically, what I don't understand is the _BV(). Thanks for any and all helpwith this. Respectfully, Chuck Reel |
---|---|
June 06, 2011 by Ralphxyz |
Hi Chuck, the _BV is referencing a "macro" you can do a Google search for "C Macros" and you can search the Nerdkits forum for "_BV" to see a lot of discussions. Ralph |
June 06, 2011 by Rick_S |
That stands for bit value and is the same as saying PORTD |= (1<<1); if it was _BV(4) it would be (1<<4) etc... Just a shortcut that is sometimes used for code compatability or ease of writing or personal preference. I know one of our friends here (Noter) uses this method often. He may be able to explain it better than I. HERE IS A LINK to the avr-libc doc for that. Rick |
June 06, 2011 by Snoogie2563 |
Thanks Guys, I saw it used in several code examples I saw in various places, but I never really saw a clear explanation of what it meant. |
Please log in to post a reply.
Did you know that our USB NerdKit works on Windows, Linux, and Mac OS X? Learn more...
|