FFT Analysis of 200Khz Square wave

DSO screenshot of 200khz rectangular wave
DSO screenshot of 200khz rectangular wave

Generated 200khz square wave with 50% duty cycle on atmega32.
Code is written in assemble language.

// Created: 9/7/2018 8:24:31 AM
// Author : abhay
.INCLUDE "M32ADEF.INC"
//.MACRO INITSTACK
LDI R16,HIGH(RAMEND)
OUT SPH,R16
LDI R16,LOW(RAMEND)
OUT SPL,R16
//.ENDMACRO
// INITSTACK
LDI R16,0X02
SBI DDRB,1
SBI DDRB,3
LDI R17,0
OUT PORTB,R17
BEGIN: RCALL DELAY
EOR R17,R16
OUT PORTB,R17
// OUT OCR0,128
RJMP BEGIN
DELAY:
LDI R22,200
OUT OCR0,R22
LDI R20,0XF2
OUT TCNT0,R20
LDI R20,0X01
OUT TCCR0,R20
AGAIN:
IN R20,TIFR
SBRS R20,TOV0
RJMP AGAIN
LDI R20,0X00
OUT TCCR0,R20
LDI R20,(1<<TOV0)
OUT TIFR,R20
RET

DSO screenshot of 200khz rectangular wave
DSO screenshot of 200khz rectangular wave
FFT of pulse showing main lobe and one side lobe.

In this fft, it can be clearly seen that the 200khz pulse is represented by a high but we can also see the harmonic of the pulse.

Here are some more fft

Leave a Reply

Your email address will not be published. Required fields are marked *