How to know PWM counter counts up or down? (in center aligned mode)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-06-09 2:57 AM
Posted on June 09, 2016 at 11:57
Hello masters ,
Is there any kind of way or register that PWM counter is counting up or down in center aligned mode? I need to control the system depends on up counting. So i have to check timer counts up or down . #discovery #output #pwm #stm32f4
Labels:
- Labels:
-
STM32F4 Series
-
TIM
This discussion is locked. Please start a new topic to ask your question.
12 REPLIES 12
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-06-12 10:20 PM
Posted on June 13, 2016 at 07:20
I use True Studio and just dont know
reading syntax
of the stm32f4 standart peripheral library . I mean how to write a code to read a register :\Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-06-13 2:03 AM
Posted on June 13, 2016 at 11:03
SPL does not appear to have a dedicated function or macro for this particular purpose, but I don't use SPL.
However, have a look into [SPL's directory]\Libraries\CMSIS\Device\ST\STM32xxxx directory, there are stm32yyyyxx.h headers there, which contain everything you need for direct register access: defines for addresses of every peripheral, struct typedefs for registers of that peripheral, and defines for bits/fields within those registers. So, #include the appropriate stm32yyyyxx.h header (you most probably have that included already, directly or indirectly), and then you can write something like if (TIM1->CR1 & TIM_CR1_DIR) { // counting down } else { // counting up } JWOptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-06-14 12:46 AM
Posted on June 14, 2016 at 09:46
Thank you all, especially Jan, last code helped me to solve the problem, I have started project with SPL . So i cant change it anymore . maybe i can try HAL Library at next project .

- « Previous
-
- 1
- 2
- Next »