Line 35: Line 35:
 
<html>
 
<html>
 
<script src="https://gist.github.com/SaheblalBagwan/f0bd96ce77327ea39989.js"></script>
 
<script src="https://gist.github.com/SaheblalBagwan/f0bd96ce77327ea39989.js"></script>
 +
</html>
 +
 +
 +
 +
 +
=Switch Buzzer Code=
 +
Below points needs to be considered for this example.
 +
* Include the io.h file as it has the definitions for all the PORT registers.
 +
* Configure PORTA as inputs to read the switch status.
 +
* Configure the PORTC as Output to turn ON/OFF the Buzzer.
 +
* Continuously read the switch status and control the buzzer accordingly.
 +
<html>
 +
<script src="https://gist.github.com/SaheblalBagwan/d64fac6230cd8a35bf9b.js"></script>
 
</html>
 
</html>
  

Revision as of 17:41, 4 February 2016

Guru (talk) 20:00, 17 November 2015 (IST)


The Rock (1996)


Objective

After blinking the leds and Controlling them using switches, its time to make some noise using the buzzer. In the first part of the tutorial, we will beep the buzzer with a delay of 1sec. At the end we will control the buzzer using a switch.

Register Configuration

Please refer the below tutorial for basics of GPIO register configuration.



Buzzer Beep Code

Below points needs to be considered for this example.

  • Include the io.h file as it has the definitions for all the PORT registers.
  • Include delay.h file to use the delay functions.
  • Configure the PORT as Output before writing any data to PORT pins.
  • Turn ON and OFF the buzzer with a delay of 1sec.



Switch Buzzer Code

Below points needs to be considered for this example.

  • Include the io.h file as it has the definitions for all the PORT registers.
  • Configure PORTA as inputs to read the switch status.
  • Configure the PORTC as Output to turn ON/OFF the Buzzer.
  • Continuously read the switch status and control the buzzer accordingly.

Wiring diagram


Video Tutorial