![]() Rearranging into a more familiar form, we get T2 - T1 = (N + 1) + (C1 - C2). To generalize this process, we can express the equation as T2 - T1 = C1 + 1 + N - C2, where N is the load value. So the total amount of time (in cycles) that has elapsed is 406 + 1 + 148 = 555, which in seconds is 555 / 1000 = 0.555 seconds. Finally, the counter value is now at the load value (999), and we need to know how many cycles it takes to get from there to T2. The counter takes on cycle to be reloaded, so we add 1 to our total. So it takes 406 cycles to get to the first rollover. We know the rollover occurs when the counter value reaches 0, so we need to know how many cycles it takes to get from T1 to 0, which is simply C1 - 0 = C1. Instead, let’s find the time from T1 to the rollover point. ![]() In this case, our previous formula won’t hold because a rollover has occurred between T1 and T2. Suppose T2 is taken when the counter reads 851 and three rollovers have occurred since the beginning. ![]() With the same counter frequency and load value as before, suppose we establish T1 as the point when the counter reads 406 and two rollovers have occurred since the timer was started. This formula holds true when no rollover has occurred between T1 and T2. Thus, we can summarize this behavior with the formula T2 - T1 = C1 - C2, where C1 is the initial counter value and C2 is the final counter value. Converting this into seconds by dividing by the counter frequency, we get 134 / 1000 = 0.134 seconds. How much time has passed? In this situation, no rollover occurred in between the two time points, so we can simply find the difference between the two values. The counter is at 693 and no rollover has occurred. We then check the counter value after another period of time. The counter is currently at 827 and no rollovers have occurred yet. We start the timer, let it run for a bit, and then check its counter value. Nonetheless, suppose we had a Timer32 configured as periodic timer, with a counter frequency of 1000 Hz and a load value of 999. Thus, we have a slightly different scenario from the stopwatch example. Which does not consume the timer/pwm component.With a periodic timer, the counter is being decremented as time passes. If all you need is a pit (periodical interrupt time) of ms order, */Īfter writing above, I have another suggestion. Uint16_t period = 9999 /* make period to 10,000 */ĬyGlobalIntEnable /* Enable global interrupts. * Timer Period = Timer Period / Clock Frequency Timer_ClearInterrupt(Timer_INTR_MASK_TC) Please specify appropriate pin number for LED. Note: Since I don't have a board with this MCU, I could not physically test it. Note: To make it easer to see the result, I changed the clock frequency to 10kHz. To test this I wrote a sample project for CY8C4025AZI-S413 Setting the Clock Frequency as a Fractional Value of Source Clock in PSoC 4/PSoC 6 MCU - KBA229104 Timer's Period = (Max_Value+1) / (clock's frequency / prescaler) = (Max_Value+1) x prescaler / (clock's frequency)Ībout the clock's fraction setting, please refer to the document below Timer's Period = (Max_Value+1) x clock's period = (Max_Value+1) / (clock's frequency)īut usually the clock could be very fast, so using the Prescaler, clock's frequency can be divided So the interrupt period of the timer will be So I use "Max_Value " instead of "Period" to avoid confusion, here.Īs the counter starts from 0 to the Max_Value, the real "Period" becomes Max_Value + 1.Īnd the real time it takes is the period x clock's period.Īnd clock's period = 1/(clock's frequency). It actually is the Maximum value of the counter. Maybe, I'm trying to explain something redundant.įirst of all, IMHO, the word "Period" in timer/pwm is misleading. When manually configuring a pin as the input to the EXTCLK, the drive mode of the pin must be set to high-impedance digital to enable the digital input buffer. Please note that the device always starts up using the IMO and the external clock must be enabled in user mode so the device cannot be started from a reset, which is clocked by the external clock. ![]() The allowable range of external clock frequencies is 1–48 MHz. Thus, the only option left in this case to get a high accuracy clock is to use an EXTCLK.ĮXTCLK can be provided to PSoC 4 by providing a clock signal as input through one of the pins. Since RTC can only be clocked with devices that have WDTs or Deep Sleep Timers, if WDT which is connected to LFClk cannot be sourced by WCO, then it basically means for this particular device, RTC cannot be used with WCO. Sorry for the delayed response but I see that Len has already answered your query.įor the MPN ( CY8C4025AZI-S413) that you are using it is not possible to use WCO for trimming the IMO.Īlso, LFCLK can only be sourced from ILO even though WCO is available. Infineon MATLAB/Simulink Users Community.AIROC™ Wi-Fi and Wi-Fi Bluetooth Combos.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |