Interfacing GY 26 with atmega640

Hello friend once again with new instructable in this I will show you how to interface GY 26 with UART when I started working on this very less resource where availble over internet .Thus i thought to share my piece of work
.GY 26 is a digital compass which gives angle with respect to earth north .it can be used for robot orientation and position aero model position and so on. GY26 uses UART or IIC for communication with microcontroller . communicating with GY 26 is simple and straight forward .
Interfacing GY 26 with atmega640

Step 1: Understanding UART in AVR

In AVR there are five register
1) URR-is used to set the baud rate for serial communication which is agreed by both the devices which is given by X=(F_CPU/16(desired baud rate))-1
2)USCRA-has flag of all USART interrupts
USCRB-this register is used to enable yhe interrupt
USCRC-this is the control register which is used toset the mode synchronous or asynchronous ,parity bits,stop bits,character size and clock polarity.
3)UDR-data registor
the timing is very critical issue check the frequency at which your board is running
here is a site for USART
http://newbiehack.com/USARTDetailed.aspx
 

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top