New answers tagged

0

You'd just use an integerin a timer interrupt, and increase it (count) as many times as necessary to reach 50 Hz. In your case, your timer interrupt would count up to 62500 / 50 = 1250, then reset to zero, and also trigger the update. pseudo-code: global integer counter; //initialize to 0 void timer_interrupt_service_routine(): counter = counter + 1 ...


1

the problem was that my character array holding the data to send over UART was not large enough to hold the information i was trying to send. this line in the code-- char buff[64];//output UART buffer


0

If you are not using the timer for anything else, then it does not really matter. Of course, if it is put in the first block instead of the second, it will be executed a few cycles earlier. If you plan to use this timer for anything else as well (although I wouldn't use HAL functions for anything where timing is critical), then TIM2_IRQHandler() is not the ...


0

It shouldn't matter much, at least in this case. Looks like the HAL library's handler HAL_TIM_IRQHandler calls all the capture callbacks you've registered and resets your timer's interrupt flag. If you don't use them, or don't care about the order in which they are executed with respect to your pin toggle, you can use either one. The difference could be ...


1

It looks like I found a solution highly dependent on the device parameters. Low leakage parts are the critical factor. Take careful selection of Ids @ Vt and Vgs Two inversions are done: The 1st must have a gate threshold of << 1/3 to 1/2 of Vbat and not 2 to 4V. This is what causes decay on the 1st time constant. hi-side mechanical switch, low-...


0

You are probably getting the memory address of the DRV_TMR0_CounterValueGet function rather than the return value because you didn't call the function. You must call the function with () i.e. teste = DRV_TMR0_CounterValueGet(); (not teste = DRV_TMR0_CounterValueGet;)


2

Dynamic drivers in Harmony ask for which peripheral you want to talk to as an argument. Static drivers have the hardware instance numbers hard coded so don't require an argument. Have a look for details here


1

I'm answering based on the MCC image you posted which relates to PIC16F and not your chosen PIC32MX which may be the source of your confusion. You should run MCC with your PIC of choice to fully understand what it is doing with your chosen PIC. The timer period is the time it takes for the timer interrupt to occur. MCC just works out hidden variables so ...


1

You're right on most of the points. PICs use typically any of the available clocks, usually the internal low frequency clock, internal or external (crystal) high frequency clocks, going through a prescaler for that particular timer, or an external pulsetrain, in which case it acts as a counter, since that pulsetrain doesn't need to be regular. There's ...


3

Unless otherwise configured the timer will use the internal clock the rest of the PIC runs off of to increment. The timer will increment to its max value, although there are MCUs that are capable of incrementing to a particular value, or decrement to zero. I haven't used PICs too often but I think for at least the older ones if you to decrease the amount of ...


1

All PIC timers increment at each input clock cycle. Older PIC16 only have system clock as a timer input (plus an external pin) while newer ones usually have pre- and postscalers, multiple clock sources, etc. For you code to work in the same way you need the same input clock. Find out the exact timer clock on your PIC16 and make it the same on PIC32.


0

To expand on Dave's answer, insert a 100 nF capacitor between U2 pin 3 and U3 pin 2. Add a 10 K pull up resistor between U3 pin 2 and Vcc. Because the Trigger input transition level is only 0.33 x Vcc, this is an approx. 0.28 ms pulse width, which is short enough not to interfere with U3's output timing.


0

HAL_TIM_PeriodElapsedCallback() is never called because there is no code to call it. It is supposed to be called from TIM2_IRQHandler(). Here is a basic timer setup with interrupts every minute, assuming the APB1 clock is 80 MHz. volatile int start_processing; void TIM2_IRQHandler(void) { if(TIM2->SR & TIM_SR_UIF) { // check status ...


1

Frequency counters can get complicated quick depending on the bandwidth you want and the clock speed of the internal clock as well as the size of the registers holding the clock ticks and the input ticks. I mean it looks like it'll work but you should make sure that (1) the clock counter and the frequency counter are refreshed at the end of the sample (2) ...


0

This can be achieved with a retriggerable monostable, such as CD4538. This will need a buffer, such as 2N7000, to drive the relay, but otherwise should be fine running off 12V. You need a catch diode across the relay coil. You can trigger the CD4538 from either a positive- or a negative-going edge - just tie the other input accordingly.


0

You can do that, with a bit of effort. However, you're really crossing into regions where it's much easier to simply learn how to use an arbitrary low-cost microcontroller (e.g. an Arduino-compatible) and program exactly what you want. Much more flexible, much less potential for analog headache! To achieve that, you could catch the falling edge of the ...


0

Probably no difference at all, since the same flip-flop design is likely used in both places. Whichever way you configure it, you have the same number of flip-flops toggling at the same rates.


2

TIM3 is on APB1 (see RCC_APB1RSTR). This means in your configuration the TIM3 clock is 72 MHz, since it's derived from PCLK1 x2.


2

Welcome to EE StackExchange. I'm not familiar with Keil tools, but a quick internet search yields this, so the answer is Yes. A practical approach would be to use an GPIO and an oscilloscope. Set the GPIO high when entering you function/task and low when exiting. Connect the scope probe to the GPIO and you can measure the execution time and frequency of ...


1

Sort of... If you have the TRACESWO pin connected, you can stream limited realtime debug data to keil. One of the things it can include here is the time spent in each ISR. Also, it is most likely possible to measure performance of threads when using Keils own operating system RTX. If you own the ULINK Pro, and have the parallel ETM interface wired up, you ...


0

You should connect a 555 timer pin2 (trigger) to the line that feeds the relays signal . And connect pin3(output) directly to the same line that feeds the relays signal. A high value resistor should be placed between this line and ground. Look online for falling edge-triggered monostable delay 555 timer. With a simple capacitor and a resistor You should ...


Top 50 recent answers are included