Download Print this page

NEX ROBOTICS Fire Bird V ATMEGA2560 Software Manual page 58

Robotic research platform
Hide thumbs Also See for Fire Bird V ATMEGA2560:

Advertisement

NEX Robotics
3.6 Functions used by the robot for configuring various ports of the
ATMEGA2560 microcontroller
3.6.1 Buzzer
Buzzer is connected to the PORTC 3 pin of the microcontroller.
Buzzer is turned on of logic 1 is applied at the PORTC 3 pin. For more information on the
hardware refer to section 3.13 in the Hardware Manual.
3.6.1.1 buzzer_pin_config()
PORTC 3 pin is configured as output with the initial state set at logic 0 to keep the buzzer
off.
void
buzzer_pin_config (void)
{
DDRC = DDRC | 0x08;
PORTC = PORTC & 0xF7;
}
3.6.1.2 buzzer_on()
Turns on the buzzer by setting PORTC 3 pin to logic 1.
void
buzzer_on (void)
{
unsigned char
port_restore = 0;
port_restore = PINC;
port_restore = port_restore | 0x08;
PORTC = port_restore;
}
3.6.1.3 buzzer_off()
Turns off the buzzer by setting PORTC 3 pin to logic 0.
void
buzzer_off (void)
{
unsigned char
port_restore = 0;
port_restore = PINC;
port_restore = port_restore & 0xF7;
PORTC = port_restore;
}
3.6.2 Interrupt switch
Interrupt switch is connected to the PORTE 7 pin of the microcontroller. It has 10Kohm external
pull-up resistor. When switch is pressed PORTE 7 pin is connected with the ground. Fore more
details on the hardware refer to the section 3.19.10 in the Hardware Manual.
Interrupt switch is used as general purpose input device. Interrupt switch is configured as input
with its internal pull-up resistor enabled.
void
interrupt_switch_config (void)
{
DDRE = DDRE & 0x7F;
PORTE = PORTE | 0x80;
}
www.nex-robotics.com
//Setting PORTC 3 as output
//Setting PORTC 3 logic low to turnoff buzzer
//PORTE 7 pin set as input
//PORTE7 internal pull-up enabled
Fire Bird V Software Manual
58

Advertisement

loading
Need help?

Need help?

Do you have a question about the Fire Bird V ATMEGA2560 and is the answer not in the manual?