This project showcases serial data communication between two ATmega32 microcontrollers, meticulously implemented using AVR Assembly Language. The core focus is on register-level USART-based transmission and reception.
2
Academic Context
Completed as a cornerstone of Microprocessor Systems coursework, this endeavour highlights practical expertise in low-level microcontroller programming and hardware interaction.
Project Objectives
USART Implementation
To implement Universal Synchronous Asynchronous Receiver Transmitter (USART) communication from first principles.
Assembly Data Exchange
To transmit and receive data robustly using AVR Assembly Language, ensuring efficient communication.
Memory Storage
To proficiently store all received data within designated memory locations.
Hardware Control
To control external output hardware via PORTC based on received serial data.
Polling Communication
To gain a comprehensive understanding of polling-based serial communication mechanisms.
Hardware Utilised
Two ATmega32 microcontrollers for sender and receiver roles.
A stable Crystal Oscillator for precise clocking.
Dedicated Serial Communication Lines for data transfer.
LEDs or a 7-Segment Display for visual output indication.
A reliable Power Supply to energise the circuit.
Software Toolkit
AVR Assembly Language for low-level programming.
AVR Studio / Microchip Studio for development and debugging.
Proteus for comprehensive circuit simulation and validation.
USART Configuration Parameters
The USART module was meticulously configured to establish reliable serial communication, adhering to industry-standard settings for robust data exchange.
Baud Rate
9600 bps for a balanced data transfer speed.
Data Bits
8 data bits for standard character transmission.
Stop Bits
1 stop bit to ensure proper frame termination.
Parity
No parity for simplicity in this implementation.
TX/RX Enable
Enabled via UCSRB register for full duplex operation.
System Operation Flow
The interaction between the two ATmega32 microcontrollers follows a precise sequence to ensure data integrity and system responsiveness. The process encompasses transmission, reception, storage, output control, and acknowledgment.
Data Transmission
The primary microcontroller transmits data serially.
Data Reception
The secondary microcontroller actively receives incoming data.
SRAM Storage
Received data is efficiently stored in Static Random-Access Memory (SRAM).
Device Control
The secondary microcontroller controls output devices based on stored data.
Acknowledgment
An acknowledgment signal is sent back to confirm successful reception.
Efficient Memory Handling
Effective management of memory is crucial for storing incoming serial data. This project employs a direct approach to SRAM utilisation and pointer manipulation.
SRAM Allocation
Data storage commences at SRAM address 0x100, providing a dedicated block for incoming bytes.
Pointer Registers
The X and Y pointer registers are strategically used for precise memory addressing and traversal.
Sequential Storage
Each received byte is stored sequentially, ensuring an ordered record of the communicated data.
Precise Timing Control
Accurate timing is paramount for synchronous operations and generating specific delays within the system.
Timer1 Utilisation
Timer1 is configured to generate the necessary precise delays, critical for system synchronisation.
Overflow Monitoring
The overflow flags of Timer1 are continuously monitored to ensure timing accuracy and event triggering.
Output Interfacing
The received data is translated into tangible actions on connected peripheral devices.
PORTC Configuration
PORTC is specifically configured as an output port, driving external hardware components.
Binary Pattern Control
Binary patterns derived from received data are sent to PORTC to control LEDs or displays, providing visual feedback.
Key Learning Outcomes
This project provided invaluable practical experience and deepened understanding across several fundamental embedded systems concepts.
Hardware Programming
Proficiency in low-level hardware programming using assembly language.
USART Protocol
Comprehensive understanding of the USART serial communication protocol.
AVR Memory Management
Practical experience with memory management techniques within the AVR architecture.
Timing & Synchronisation
Mastery of timing and synchronisation methods crucial for embedded applications.
Embedded Design
Enhanced skills in the overall design and implementation of embedded systems.
Project Summary and Future Considerations
Limitations
The current implementation relies on a polling-based approach, which can be less efficient than interrupt-driven methods.
There is no interrupt handling, potentially limiting responsiveness in complex scenarios.
Fixed communication parameters mean less flexibility for varied applications.
Conclusion
This project successfully demonstrates reliable data communication between two AVR microcontrollers. It significantly strengthens an understanding of fundamental embedded systems and serial protocols.
Thank You!
Your attention is appreciated. Questions and discussion are most welcome.