9.4 Application examples
9.4.1 Application example: SPI master (ATMEGA2560)
Located in the folder "Experiments \ A_SPI_Master" folder in the documentation CD.
This program is for ATMEGA2560 (master) microcontroller. This program demonstrates SPI
communication between master (ATMEGA2560) and slave (ATMEGA8) microcontroller. LCD
displays analog values of the IR Proximity sensors 6, 7, 8 which are obtained from the
ATMEGA8 (slave) microcontroller.
Notes:
1. Setting for ATMEGA2560 (master) microcontroller
Make sure that in the configuration options following settings are done for proper
operation of the code
Microcontroller: ATMEGA2560
Frequency: 14745600
Optimization: -O0
(For more information read section: Selecting proper optimization options below figure
2.22 in the software manual)
2. ATMEGA2560 (master) and ATMEGA8 (slave) microcontrollers use SPI bus for ISP as well
as for the communication between them. Before doing ISP we need to disconnect the SPI bus
between these two microcontrollers. Remove tree jumpers marked by J4 on the ATMEGA2560
microcontroller adaptor board before doing ISP.
3. Connect 3 jumpers marked by J4 to connect SPI bus between the microcontrollers.
4. Do not pass value more than 7 to the function "spi_master_tx_and_rx" else it will give back
random value
© NEX Robotics Pvt. Ltd. and ERTS Lab IIT Bombay, INDIA
Fire Bird V ATMEGA2560 Software Manual
117
Need help?
Do you have a question about the Fire Bird V ATMEGA2560 and is the answer not in the manual?