| Electronics > Beginners |
| Fast square wave with arduino and mosfet |
| << < (3/10) > >> |
| ledtester:
--- Quote from: ManlishPotato on September 19, 2019, 07:41:13 pm ---Hey y'all I'd like to make a tank circuit with a coil and capacitor in parallel. To power it i need a really frequent square wave. 1 mhz would be nice but maybe about a 500-600 mhz minimum. --- End quote --- What are the values of your capacitor and inductor? And what exactly do you want to accomplish? To get a tank circuit to ring you don't need to continually excite it. Once excited it will ring on its own at its resonant frequency. Also, you don't have to directly couple it to your signal source. You can excite the tank by just wrapping a wire carrying your square wave around the inductor a few times. Have a look at this page in the section "Measuring LC tank circuits": http://www.giangrandi.ch/electronics/ringdownq/ringdownq.shtml Just a fast rising edge is enough to transfer energy into the tank, so your signal source doesn't have to pulse at a fast frequency. |
| Mechatrommer:
--- Quote from: djacobow on September 20, 2019, 01:11:57 am ---I think with a 16 MHz Arduino, your highest possible toggle speed is 2.67 MHz. cli(); while (1) { PORTD |= 0x8; PORTD &= ~0x8; } Looks like that's 6 instructions. --- End quote --- 4 instructions minimum. 2 ops to toggle pin on and off, 2 ops for goto. hence 16MHz / 4 ops = 4MHz maximum, but only in asm... |
| ledtester:
You could always unroll the loop and on a 16 Mhz atmega328 achieve 8 Mhz for about 2 milliseconds at a time with only a 100ns glitch between runs. On a atmega2560 the 8 Mhz pulse train would last for around 16 ms. |
| T3sl4co1l:
Millihertz or megahertz? It matters, rather a lot. You can still connect an Arduino to something that can make 600MHz, but it's going to be a frequency synthesizer chip, something fit for purpose -- nothing the Arduino has direct participation in, only setting registers. It's also not going to drive as much power as one of those transistors can, and you need special RF transistors to amplify it if you need to. Tim |
| mikerj:
Maybe I missed something, but why is the OP trying to toggle a port pin as fast as possible through bit bashing rather than using a PWM output? |
| Navigation |
| Message Index |
| Next page |
| Previous page |