Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

AVR serial output the easy way, with moderate effort, and the hard way For Lab 4, you must implement a function that outputs string of

AVR serial output the easy way, with moderate effort, and the hard way For Lab 4, you must implement a function that outputs string of bytes using one of the AVR's output pins and display them on the oscilloscope, through a terminal program on your computer, and show the output on the scope to the lab instructor. There are three ways to accomplish this, each earning successively more points:

The minimum effort for 25 points on lab 4 is also the easiest method: simply use the built-in USART hardware of the AVR to transmit a serial string consisting of your Red ID. Start simply by transmitting a single byte over and over and probe it with the oscilloscope to see what the output looks like on the scope. You must set up the USART's serial mode and bit rate (a.k.a. baud rate) to 9600bits/sec, 8 data bits, 1 stop bit, and poll the transmit status register to wait until it is ready before writing an output data byte to the USART's serial data register. Note that the debug hardware on the Xplained board also uses the hardware USART pins PD1 (TXD) and PD0 (RXD) UART pins on the AVR uC, so they will show activity while downloading your code. So you cannot use the debugger and do serial I/O at the same time with this method. The other two methods do not use the hardware UART, so the debug capability is available for methods 2 and 3 below. You must program and run this version #1 of the program without the benefit of debugging. So this code is easier to write, but harder to debug. For full credit on this one, you must still output your Red ID number -- see below.

Required Output: In any case, the final output demonstration is to show the ASCII characters corresponding to the 9 digits of your Red ID followed by carriage return (0xd) and linefeed (0xa) followed by a 500mS delay are repeated continuously at 9600 bits per second (one bit period = 1/9600 seconds, ~100uS/bit, at 10 bits.byte = ~1ms per character. Hook the serial output signal from your program to the USB to serial adapter on the small red circuit board from Sparkfun in your kit with the USB cable to your PC's, and display it on your PC using a serial terminal utility like putty or hyperterminal for windows, or the built-in terminal program on the Mac. The terminal program should display your Red ID number on a separate line approximately every 500mS. This is the sort of problem that is representative of debugging real embedded projects, when there are few resources and pins left over for debugging your code in an operating product, and you may have to bit bang an output pin to see the information you need to debug your application. By sending serial output through an LED, it's possible to get diagnostic messages from transmitting serial ASCII via a GPIO pin connected to the LED. You can access the transmitted serial data using a photo transistor or photodiode to drive a serial input to a PC or other system. I've had to do this sort of thing when there was no other method available to diagnose errors in an embedded system, and it can be a real project saver when no other options are available.

USING C LANGUAGE AND ATMEL STUDIO

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

More Books

Students also viewed these Databases questions

Question

Azure Analytics is a suite made up of which three tools?

Answered: 1 week ago

Question

What is DDL?

Answered: 1 week ago