Read multiple digital inputs at once
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-08-31 4:55 AM
I am new to STM MCU and have started working with stm8s105k4. I have a 4 bit digital input and wants to know how can I read that 4 bit at once which is connected to PORTC.
Below logic is very lengthy and not a good way to read inputs. Kindly help.
if ((!GPIO_ReadInputPin(GPIOC, GPIO_PIN_3)) && (GPIO_ReadInputPin(GPIOC, GPIO_PIN_4)) && (GPIO_ReadInputPin(GPIOC, GPIO_PIN_5)) && (!GPIO_ReadInputPin(GPIOC, GPIO_PIN_6)))
This discussion is locked. Please start a new topic to ask your question.
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-08-31 5:42 AM
uint16_t foo = GPIOC->IDR;​
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..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-08-31 6:07 AM
You should take a look at this app note.
It explains all the GPIO's registers and their use. (Including GPIOx_IDR)
Available for consulting/freelancing , hit me up in https://github.com/javiBajoCero
