I started off this week by designing the code for a passive buzzer. It was quite a simple task as I only made a few changes compared to the previous design made, they only have outputs that needed to be sent without having to read the inputs. I ran my codes but to my disappointment there was no sound coming from the buzzer at all. Just silence.
The frequency range that humans can hear are from 20 Hz to 20 kHz only. The board is 100 MHz so I thought it was probably because of not having a clock divider to lower the frequency to the range of frequency that our ears can detect. Therefore, I included a program of a clock divider to the design code which then sends about 6.1 kHz frequency. However, it did not work as the buzzer still did not sound.
I updated Dr. Shawn on this matter and only then realized that a passive buzzer should be designed differently compared to the previous program made on the 7 Colour LED. Although both of them only give outputs, a passive buzzer have the characteristic of having frequency control thus enabling us to choose which frequency goes to the buzzer. Dr. Shawn drew the main operation roughly for the design code of the passive buzzer and explained it to me. I find it very challenging as I have to take into account the bits of the counter that determines the output and the method to reload the counter automatically.
I checked the design I made before that on the active buzzer since Dr. Shawn told me that it would work on an active buzzer, but not the passive buzzer. As expected, I tested the design program on the active buzzer and it sounded perfectly. Now I am focusing on finishing the design code for the passive buzzer. It will definitely be interesting to test the program I make and observe whether it works on the buzzer. I just hope the results will be interesting just as much.