How to write set of bits in ODR?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2012-11-08 7:15 AM
Posted on November 08, 2012 at 16:15
hello , im a newbie to stm32 and im just starting with stm32f4 discovery,
i have to write an 8 bit value to GPIOA ODR from bit2 to bit9 while not altering bit0 and bit1 how can i do that? it`s a noob question but i want learn kindly help regards #set-bits-in-odr
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2012-11-08 8:24 AM
Posted on November 08, 2012 at 17:24
hello , im a newbie to stm32 and im just starting with stm32f4 discovery, i have to write an 8 bit value to GPIOA ODR from bit2 to bit9 while not altering bit0 and bit1 how can i do that?
*((__IO uint32_t *)&GPIOA->BSRRL) = ((x & 0xFF) << 2) | ((~x & 0xFF) << (2 + 16)); // Set the 1 bits, Clear the 0 bits, QED or GPIOA->ODR = (GPIOA->ODR & ~(0xFF << 2)) | ((x & 0xFF) << 2);
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
