2013-05-09 03:34 PM
what is this 1ul and 2ul and 3ul
examble RCC->AHB1ENR |= ((1UL << 0) ); /* Enable GPIOA clock * GPIOA->MODER &= ~((3UL << 2*0) ); /* PA.0 is input */ what is the new value for RCC->AHB1ENR and GPIOA->MODER #c-basics #off-topic2013-05-09 03:40 PM
UL means the number is handled as an Unsigned Long,
RCC->AHB1ENR |= 0x00000001; GPIOA->MODER &= 0xFFFFFFFC; // mask off low two bits ie ~0x00000003 The final state will depend on the initial state of the registers.2013-05-10 06:28 AM
RCC->AHB1ENR |= 0x00000001;
GPIOA->MODER &= 0xFFFFFFFC; // mask off low two bits ie ~0x00000003 thank you very much but how you convert this (3UL << 2*0) and this (1UL << 0) to number !2013-05-10 06:53 AM
but how you convert this (3UL << 2*0) and this (1UL << 0) to number !
I'm not sure I understand the question. The compiler parses suffixes which imply type information which it uses to do the computation, which can be different from the type it is later stored in, or other variables used in the computation. (Like using L to specify a long, on a compiler that would normally hold the value in 16-bit, or F to specify a float rather than a double) (3UL << 2*0) 3 << 0 3 ~3 is equivalent to 3 ^ 0xFFFFFFFF, ie the inverse or logical NOT A quick Google
http://www.parashift.com/c++-faq/numeric-literal-suffixes.html
2013-05-10 03:25 PM
Note that none of this has anything to do with the STM32 - it is all just normal, standard 'C' syntax.
Time to dust-off that 'C' textbook...http://blog.antronics.co.uk/2010/12/12/things-you-shouldve-learned-in-c-class-0-introduction/
2013-05-11 05:33 AM
Note that none of this has anything to do with the STM32
The code is an example out there for the chip, it's not an unreasonable question, we want to cultivate this as a safe place to ask question, or seek clarifications.2013-05-12 10:00 AM
Yes; but it's important to understand that this is just standard'C' syntax - not something that's in any way specific to the STM32 itself.
2014-06-18 06:21 AM
2014-06-18 07:59 AM
Hello Lakhwinder Ji,
Go to below link & download the example codes configured 4 different IDE's.http://www.st.com/web/en/catalog/tools/PF258154For more help/assistance please send me an email on monu.yadav@yosun.com.sg2014-06-18 08:13 AM
How to start a new thread