How to know PWM counter counts up or down? (in center aligned mode)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-06-09 2:57 AM
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:
-
STM32F4 Series
-
TIM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-06-09 3:07 AM
Read the PWM counter and store in one variable.
Read again the PWM counter until the value differs from the stored value. From both values coun can desipher the counter direction.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-06-09 3:13 AM
I have read but couldn't find any readable register to check
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-06-09 5:23 AM
Quoting from RM, ''Center-aligned mode (up/down counting)'' subchapter of any of timers' chapter (except the basic ones which don't have this mode):
In this mode, the direction bit (DIR from TIMx_CR1 register) cannot be written. It is updated
by hardware and gives the current direction of the counter. Can this be any cleaner? JW- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-06-09 6:39 AM
Hi Marc,
The counting direction of the counter is indicated by the DIR bit-fields in TIMx-CR1 register. -Hannibal-- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-06-09 11:22 PM
Thank you all ! But i cant read that register to control my sytstem . Do you know how is it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-06-09 11:56 PM
> But i cant read that register
Why? JW- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-06-10 12:20 AM
I dont know how to read the register :\
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-06-10 1:21 AM
How did you program the timer, then?
If you use some of the ''libraries'' (SPL or Cube), resort to the documentation of that ''library''. JW [EDIT] if you use Cube, then look at macro- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2016-06-10 2:29 AM
By having a closer look at the registers.
Which IDE are you using ?