Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Where we can find counter Period (AutoReload Register) in stm32?

Status
Not open for further replies.

Saeedk9574

Junior Member level 3
Joined
Nov 6, 2023
Messages
31
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
215
Hi Everyone,
I have set ARR = 10'000 and Prescaler = 7200 by 72MHZ clock in order to have precise 1 second.
In this regard, does anybody know where can see this AAR is saved?

I want to use its variable directly in my code.

Screenshot (184).png
 

Solution
Hi,

What I mean is, when we set ARR = 10000, it begins count from 0 to 1000,
Several mistakes in one statement

* If you set ARR = 10000 ---> but indeed you set it to 9999 according post#1.

* it begins count from 0 to 1000,
--> "it" does not count 0 to 1000 but 0 to 9999 (1000 is wrong by a decade)
--> "it" is the "counter", the AAR does not count. ARR stays at the value of 9999 as long as you don´t overwrite it.

* IF(AAR < 5000) ...
--> makes no sense, since AAR does not (automatically) change at all.
--> But for sure you may use this line of code to really check the AAR_register value instead of the counter value. We don´t know what you intend to do.
--> Also there usually is a AAR per...
Hi,

what do you mean with "where can see this AAR is saved"?
In the datasheet? In code? in library documentation? Anywhere else? (in any case you need to provede the sources / links .. if you want us to help you with this)

I want to use its variable directly in my code.
Which variable are you talking about?
AAR is a hardware register, not a variable ... or are you talking about the piece of code that uses a variable to set this register?

Klaus
 
Hi,

what do you mean with "where can see this AAR is saved"?
In the datasheet? In code? in library documentation? Anywhere else? (in any case you need to provede the sources / links .. if you want us to help you with this)


Which variable are you talking about?
AAR is a hardware register, not a variable ... or are you talking about the piece of code that uses a variable to set this register?

Klaus
What I mean is, when we set ARR = 10000, it begins count from 0 to 1000, definitely this counter is saved somewhere, so I want to use this range of 0-10'000 in my program. For example:

if(AAR < 5000){
}
else if(ARR>5000){
}
 

Hi,

What I mean is, when we set ARR = 10000, it begins count from 0 to 1000,
Several mistakes in one statement

* If you set ARR = 10000 ---> but indeed you set it to 9999 according post#1.

* it begins count from 0 to 1000,
--> "it" does not count 0 to 1000 but 0 to 9999 (1000 is wrong by a decade)
--> "it" is the "counter", the AAR does not count. ARR stays at the value of 9999 as long as you don´t overwrite it.

* IF(AAR < 5000) ...
--> makes no sense, since AAR does not (automatically) change at all.
--> But for sure you may use this line of code to really check the AAR_register value instead of the counter value. We don´t know what you intend to do.
--> Also there usually is a AAR per timer module. You need to state which module you refer to. It could be like: TMR1_AAR .. but depends on what langauge / compiler / libraries you use. We don´t know ...

*****

Again: provide links to the datasheets / documents / internet sites ... you refer to.

Klaus
 
Solution
Hi ,It can be see in Main function ,where the function declaration of static void MX_TIM1_Init(void)
Here it is a structure member like htim1.Init.Period = 1000-1; (For Eg.TIM1)
 
Hi,


Several mistakes in one statement

* If you set ARR = 10000 ---> but indeed you set it to 9999 according post#1.

* it begins count from 0 to 1000,
--> "it" does not count 0 to 1000 but 0 to 9999 (1000 is wrong by a decade)
--> "it" is the "counter", the AAR does not count. ARR stays at the value of 9999 as long as you don´t overwrite it.

* IF(AAR < 5000) ...
--> makes no sense, since AAR does not (automatically) change at all.
--> But for sure you may use this line of code to really check the AAR_register value instead of the counter value. We don´t know what you intend to do.
--> Also there usually is a AAR per timer module. You need to state which module you refer to. It could be like: TMR1_AAR .. but depends on what langauge / compiler / libraries you use. We don´t know ...

*****

Again: provide links to the datasheets / documents / internet sites ... you refer to.

Klaus
Thanks, I know all what you mentioned, I just wanted to know that if it is possible to see the counter of ARR which counts between 0-9999?
 

I have c
Hi ,It can be see in Main function ,where the function declaration of static void MX_TIM1_Init(void)
Here it is a structure member like htim1.Init.Period = 1000-1; (For Eg.TIM1)
I have already checked there, but as I mentioned, I want to use the counter of ARR that goes up from 0 to 9999 in this case.
 

ARR is not changing its value to 0,1,2 ,3 etc , it havethe the value we put ot it ie, with 9999 and compare each update (int TIMx CNT)
I think you can acceses the TIMx CNT
CNT_value = TIM1->CNT;
 
ARR is not changing its value to 0,1,2 ,3 etc , it havethe the value we put ot it ie, with 9999 and compare each update (int TIMx CNT)
I think you can acceses the TIMx CNT
CNT_value = TIM1->CNT;
Thanks, that was the register I was looking for.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top