How to pass a variable read in an interruption to main()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-06-14 6:14 AM
I'm reading a serial ADC from an interruption (24 bits)
I need to pass its read value to the main()
I have defined in /* USER CODE BEGIN PV */ a volatile variable uint32_t xxxxx
The xxxxx variable is right inside the interruption routine but it becomes 0x01FFFFFE when called in main()
How can I pass the xxxxx variable from void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) to main()?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-06-15 8:10 AM
Debugging the hardware, I have seen that after executing the execution of 'for' loop into callback function, the 'for' loop runs again.
It seems like that the interruption happened again.
But I watch on the oscilloscope that the DATAin line has not gone down (then, none interruption should happen)
DATAin line is use to interrupt the micro (first DATAin goes down, then DATAin delivers 24 data bits every clock pulse)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-06-15 8:15 AM
I think I should disable the interruption once it has begun and after exiting, to enable it again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-06-15 8:15 AM
Sorry:
I think I should disable the interruption once it has begun and BEFORE exiting, to enable it again

- « Previous
-
- 1
- 2
- Next »