The Stack Overflow podcast is back! Listen to an interview with our new CEO.

New answers tagged

0

I added these two lines and now it works. uint32_t first_val = TIM3->CNT; while ((HAL_GPIO_ReadPin (GPIOA, GPIO_PIN_2 && (( TIM3->CNT - first_val) < 8000) )));//continue after 1ms


0

Check out pin 5 on the 555. It's the control pin, and it is not documented well. But if you look a the datasheet, you'll see that pin 5 sets the reference voltage for the comparator and by changing that you can change the PWM duty cycle. wikipedia description of pin 5: Control (or Control Voltage): this pin provides access to the internal voltage ...


0

The easiest way to convert a variable voltage to PWM is to feed it and a triangle/sawtooth wave into a voltage comparator. Obviously, this means it's time to abandon the 555 implementation in favor of a new design altogether. You can get "function generator" chips that will produce the needed triangle wave more easily than you can get anything based on the ...


2

Use a 74xx4060 14-bit binary counter IC, such as the 5 V 74HCT4060. This is a cheap and readily available part and uses a resistor and a capacitor to control the increment rate of a 14-bit counter. Its 10 output counter bits are different stages of a 14-bit ripple counter. So you can choose a relatively high oscillator frequency that requires a small ...


0

As said by @RichardtheSpacecat, a 555 to generate your clock signal. For the counter, two D flip-flops would be sufficient: (assume the flip-flops output are Q_not instead of Q) simulate this circuit – Schematic created using CircuitLab


1

I figured that I made a number of mistakes: I was supposed to expect a 500Hz waveform for a 1ms timer because the pin will toogle every edge (raising and falling); There is an obvious bug in the interrupt routine that clears the interrupt flag: the TMR0IF bit should be set to 0, not to 1 The calculations for the timer register are here for reference. This ...


1

Just Googling "555 astable circuit" will list plenty of web sites. This one: 555 Oscillator Tutorial gives the equations for the on time and off time.


1

This diagram will show the correct way to cascade the two sections of a '393 chip so as to achieve an 8-bit counter. In words - Connect the two MR reset pins together. Connect Q3 of the first counter to the CP# input of the second counter. This will make the second counter increment each time the Q3 output of the first counter goes to low indicating ...


1

The normal way to cascade the two 4-bit, aka divide by 16, counters in a 393 is to connect the clock in of the second to the MSB of the first. This then gives you an 8-bit, divide by 256, counter. The MSB of the first changes state after every 8 input clocks, it completes one full cycle after every 16 input clocks. This is normally the behaviour you want. ...


0

You need a self-approving reply relying on incomplete schematics? Try, it might work. You need a detailed proper answer? Depends on the EN input of the regulator. Some of them are using an open drain solution, with voltage capabilities between supply of the buck and some logic level. In that case, provide you are in the specsheet boundaries, is OK ...


2

The equations can be calculated. In the datasheet based on figure 14 it shows the well known astable mode of operation. In this operation the capacitor charges up to \$\dfrac{2\,V_{cc}}{3}\$ through \$R_A\$ and \$R_B\$ and later discharge through \$R_B\$ until \$\dfrac{V_{cc}}{3}\$, which leads to: \begin{equation} \dfrac{2\,V_{cc}}{3} =V_{cc}+ (\dfrac{V_{cc}...


1

Yes, you can join the ground of different voltage supplies together. There's no problem with the circuit as drawn. Remember that voltages are always relative. Tying the negative poles of the two batteries together only ensures that those poles are at the same voltage, which I'm going to call "0V", just because I can. You can call it whatever you want, but I'...


1

You should have no problem interconnecting all the grounds. As a matter of fact since you want a common "off" signal from the uC connecting the grounds would be required anyway.


0

DMA requests from each peripheral are hardwired to either DMA1 or DMA2, see the request mapping tables in the DMA functional description of the reference manual. So a request from TIM1 or TIM8 can trigger a copy operation only in DMA2, other timers can only trigger DMA1. While DMA2 transfers can reach any peripheral, the peripheral addresses on DMA1 are ...


0

If you do not want to use CPU - which is not possible if you do not use external averaging hardware. Simple lowpass filter will do or another duty


1

The F4/F7 have plenty of memory to handle this. You'll need just over 200 bytes (100 samples * 2 bytes each), which is a fraction of even the smallest F4 chips. A moving average is a type of FIR filter and has some advantages to an IIR filter (such as an "infinite average"), such as that it responds more quickly to changes and will settle more quickly on a ...


1

If it were only a small number of averages then I would create a shift register. Pseudo code for a small number of averages. function movingAverage(pulseAverage) { static register[2]; // 3 registers register[2] = register[1]; // data shift register[1] = register[0]; // data shift register[0] = pulseAverage; // move the input into the ...


1

A: To get it to discharge faster add a 330 ohm between the switch output and ground, to get it even faster also add a diode parallel with the 2.2K resistor. (pointing upwards) pretty much any diode will do eg: 1n4148 or 1n4001 etc. B: more simple, the 555 behaves more predictably than most simpler circuits and is pretty simple itself, you could maybe do ...


0

A. Basically, greater current will make faster discharge. to do this, change the R to smaller value (increase current) B. IDK yed hahah C. You can use transistor, just read the datasheet to determine is using NPN or PNP.


Top 50 recent answers are included