NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Everything Else » Operators
June 11, 2011 by JoyceChee |
What does this "|=" operator in C programming means? Also, what does "(1<<ADEN)" means in C programming? Hope someone would help. Thanks. |
---|---|
June 11, 2011 by dgikuljot |
The line next to the equal sign is the bitwise or operator. Just a quick question, how do you actually type the bitwise or operator on the keyboard. |
June 11, 2011 by dgikuljot |
NVM i found the key,but JoyceChee that symbol is the or operator, in the nerdkits guide where it explains bits, bytes and stuff it explain how to use or and and operators |
June 12, 2011 by JoyceChee |
Thanks dgikuljot. does |= means "or equal"? what is the function of this operator then? |
June 13, 2011 by bretm |
is the same as
just as
is the same as
ADEN means nothing in C. It's a macro, which means it's converted into C by the pre-processor. In the case of all the bit-shift macros it just boils down to a constant integer value, e.g. 3. So (1<<ADEN) means (1<<3) which means 8 (assuming ADEN is 3, I'm just making that part up, I don't know what its value is). |
June 13, 2011 by Ralphxyz |
Huh? Isn't ADEN the 7th bit of the ADCSRA Register. Doesn't (1<<ADEN) mean 1 left shifted 7 places? Which essentially turns the ADC on.
So
At least that is what I have been led to believe would happen by those that know so much more than I. Ralph |
June 13, 2011 by mongo |
and I thought << was just a pointy hat, <<;)' |
June 14, 2011 by Rick_S |
|
June 14, 2011 by bretm |
I'm sure you're right about ADEN being 7. I didn't have a reference in front of me so I made up the number 3, which I tried to point out by saying "assuming ADEN is 3, I'm just making that part up, I don't know what its value is". |
June 14, 2011 by Ralphxyz |
Thanks bretm, I hope JoyceChee got a usable answer, no thanks to the Funny Fellows. Usually your answers are so explicit it kinda threw me with your generalized answer, which you did qualify. Following your general C programming logic ADEN could have been a variable or any other value holding aspect of the C language. I "assumed" JoyceChee was referencing AVR programing when they asked about [quote] Also, what does "(1<<ADEN)" means in C programming? [/quote] even though they asked "in C programming". I am just amazed that I was able to offer an answer. Ralph |
Please log in to post a reply.
Did you know that any circuit of voltage sources and resistors can be simplified to a "Thevenin" equivalent circuit? Learn more...
|