simple stm32 c question ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-05-09 3: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-topic- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-05-09 3: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.Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-05-10 6: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 !- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-05-10 6: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
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-05-10 3: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/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2013-05-11 5: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.Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-06-18 6:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-06-18 7: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.sg- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-06-18 8:13 AM
How to start a new thread
Up vote any posts that you find helpful, it shows what's working..
