Tag Archives: square wave

H-bridge control example for Arduino Nano (ATmega328) – two phase-displaced square waves

This is the code: Example Output In the following oscilloscope screenshots, channel 1 (yellow) displays the signal from OC2 (pin D11) and channel 2 (blue) displays the signal from OC2B (pin D3). This is the output when OC2RB = 49, … Continue reading

Posted in Uncategorized | Tagged , , , , , , , , , , , , , , , , | 1 Comment

50Hz square wave example for PIC16F1829

This post presents two example programs for the PIC16F1829 microcontroller that generate 50Hz square waves. The first example uses simple bit banging to generate the waveform. The second example uses the dedicated PWM hardware module. Example 1: bit banging In … Continue reading

Posted in PIC | Tagged , , , , , , , , , , , | 27 Comments

Two square waves with arbitrary phase shift on dsPIC

Reader Imad wrote in with an interesting query about generating two square waves with equal frequency but an arbitrary phase shift between them using a dsPIC microcontroller. I’m still working out the fine details, but here’s the general gist of … Continue reading

Posted in Uncategorized | Tagged , , , , , , , , , , , , | 32 Comments