北回归线 发表于 2014-3-6 14:40:42

几道小题 哪位朋友闲了 帮忙做下 50元酬劳

题不多 哪位朋友做了80分以上钱不多 50话费 或者直接打支付宝   
要求80分以上绝不食言 截止到今晚上 8点 (2014/3/6)
或许有人说 大神写个流水灯也得上万对此不多说
QQ : 137740979

北回归线 发表于 2014-3-6 14:43:06

CprE 288 Spring 2014 – Homework 6


Note: Unless otherwise specified, all problems assume the ATMega128 is being used
Question 1: USART Basics (10pts)
Sketch the waveform appearing at the output of the USART when it transmits a character ‘7’ at 57,600 baud rate (see the example on slide 4, week 6). The sketch should show the bit durations in microseconds, in addition to the waveform. The frame format is of 1 start bit, 8 data bits, an even parity bit, and 1 stop bits.
Question 2: USART Programming (20pts)
You are asked to program an ATmega128 so that it plays as a one-way USART reply node from USART0 to USART1: Any character received by USART0 should be transmitted through USART1 to the outside. The program must be interrupt-based, so the microcontroller can do other work.
a. Assume the ATmega128 runs at 16MHz. Write a USART_init() function to initialize both USART units as follows:
•        Asynchronous communication
•        USART0 as receive only, USART1 as transmit only
•        115,200 baud rate
•        8 data bits
•        no Parity
•        1 stop bit
•        An interrupt enable bit is set if and only if that is necessary.
You may initialize unrelated control bits as you wish.



b. What interrupt handler(s) do you have to write to implement the reply functionality? Explain.
Then, write the interrupt handler(s). You code should check for communication overflow: if USART0 receives a character but USART1 is not ready for transmitting, then the received character should be discarded. In other word, your code should check the UDRE flag in UCSR1A before it writes to UDR1. You need to find out the interrupt vector code, which is available in the ATmega128 datasheet.
Note: Reading UDRn will clear the RXC interrupt flag and consequently the interrupt signal, so your code does not have to clear that interrupt flag.



Question 3: ADC Design Principle (10 pts)

Suppose that an ATmega128 is used with a thermal sensor to monitor the ambient temperature. The sensor measures temperature in range of -50 degree Celsius to 150 degree Celsius and converts temperature proportionally to an electrical signal of voltage range from 0.0V to 2.0V. The ADC uses the reference voltage of 2.56V. Assume that the number of steps is 2n, where n is the number of bits of the ADC output. Recall that the ADC in ATmega128 is 10-bit.

a.        If the ambient temperature is 32 degree Celsius, what is the voltage of the sensor’s output? (3 pts)



b.        What is the corresponding digital reading from the ADC output? (3 pts)




c.        If the digital reading is 300, what is the range of the analog value? Note that each digital number corresponds to a step (a small range in the span) of the analog value. (4 pts)



Question 4: ADC Design Principle (10 pts)

A 4-bit ADC (of 24 = 16 steps in the analog range) uses the Successive Approximation implementation. The input voltage range is 0.0V-16.0V. If the input is 5.0V, how does the ADC work out each bit of the digital encoding? Fill the following table to show the steps (as did in the class). The first step is given.

Step                Range                DN_Mid       AV_Mid(V)           Input >= AV_Mid
0                xxxx                1000              8                   0
1                0xxx       
2
3
4

The digital value is_____ (binary) and _____ (decimal).

Question 5: ATmega128 ADC Programming (5 pts)

Describe in a few sentences how to use the ADSC bit in ADCSRA to start an ADC conversion, and to wait for the ADC conversion result to be ready.

Question 6: ATmega128 ADC Programming (10 pts)

Assume ATmega128 platform with the system clock configured to 4MHz (for improved power efficiency). Write two C statements to configure the ADC as follows:
•        Interrupt enabled
•        One-shot mode
•        ADC clock rate in the range of 50K-200K Hz
•        Reference voltage is Vcc
•        No differential input
•        ADCW right adjusted
•        The initial input channel is 7

ADC_init()
{




}


Question 7: ADC Programming (20 pts)

A Atmega128 is being used to monitor humidity inside test chamber 03. The device uses two sensors to have some fault tolerance.They are connected to ADC channels 0 and 1. The program uses the average and maximum error of the two values. Previously the program used interrupts to update the average and the maximum error of the two sensors, but recently the interrupts on the chip stopped working. GLaDOS has asked you to write code to do this with polling instead of interrupts.
Other notes:
        MaxError can only be set to a higher value
        The ADC has been initialized like the question above
        Using a spin lock to wait for ADSC to clear is ok.

Void updateHumidity(unsigned* maxError, unsigned* ave){
        //your code
}
main(){
        unsigned MaxError = 0;
        unsigned Ave = 0;
        init();
        while(1){
                updateHumidity(&MaxError, &Ave);

                // Somebody else’s problem
        }
}

Kvaqdxjl9f 发表于 2014-3-6 14:44:03

呵呵。            

mhw 发表于 2014-3-6 14:46:20

国外,作业?

mutoudonggua 发表于 2014-3-6 14:47:56

都不好好整理一下,这。。。。。。
这里的人都不傻,楼主

北回归线 发表于 2014-3-6 14:49:07

mhw 发表于 2014-3-6 14:46
国外,作业?

嗯                                 

北回归线 发表于 2014-3-6 14:50:25

mutoudonggua 发表于 2014-3-6 14:47
都不好好整理一下,这。。。。。。
这里的人都不傻,楼主

word文档上传不了 你看了吗说没好好整理 问题 1 2 3 4 标注的很清楚

90999 发表于 2014-3-6 15:08:28

CprE 288 Spring 2014 – Homework 6


Note: Unless otherwise specified, all problems assume the ATMega128 is being used
Question 1: USART Basics (10pts)
Sketch the waveform appearing at the output of the USART when it transmits a character ‘7’ at 57,600 baud rate (see the example on slide 4, week 6). The sketch should show the bit durations in microseconds, in addition to the waveform. The frame format is of 1 start bit, 8 data bits, an even parity bit, and 1 stop bits.

#include <homework_6_answer.h>

void main()
{
Q1(1,7,57600,1,8,0,1);
}




Question 2: USART Programming (20pts)
You are asked to program an ATmega128 so that it plays as a one-way USART reply node from USART0 to USART1: Any character received by USART0 should be transmitted through USART1 to the outside. The program must be interrupt-based, so the microcontroller can do other work.
a. Assume the ATmega128 runs at 16MHz. Write a USART_init() function to initialize both USART units as follows:
•      Asynchronous communication
•      USART0 as receive only, USART1 as transmit only
•      115,200 baud rate
•      8 data bits
•      no Parity
•      1 stop bit
•      An interrupt enable bit is set if and only if that is necessary.

You may initialize unrelated control bits as you wish.

#include <homework_6_answer.h>

USART_init()
{
Q2_a(0);
Q2_a(1);
}

void main()
{
SetCPU_Mhz(16);
USART_init();
}


b. What interrupt handler(s) do you have to write to implement the reply functionality? Explain.
Then, write the interrupt handler(s). You code should check for communication overflow: if USART0 receives a character but USART1 is not ready for transmitting, then the received character should be discarded. In other word, your code should check the UDRE flag in UCSR1A before it writes to UDR1. You need to find out the interrupt vector code, which is available in the ATmega128 datasheet.
Note: Reading UDRn will clear the RXC interrupt flag and consequently the interrupt signal, so your code does not have to clear that interrupt flag.


#include <homework_6_answer.h>


void USART_init()
{
Q2_b(0);
Q2_b(1);
UART_interrupt(Q2_bb);
}

void main()
{
SetCPU_Mhz(16);
USART_init();
}



Question 3: ADC Design Principle (10 pts)

Suppose that an ATmega128 is used with a thermal sensor to monitor the ambient temperature. The sensor measures temperature in range of -50 degree Celsius to 150 degree Celsius and converts temperature proportionally to an electrical signal of voltage range from 0.0V to 2.0V. The ADC uses the reference voltage of 2.56V. Assume that the number of steps is 2n, where n is the number of bits of the ADC output. Recall that the ADC in ATmega128 is 10-bit.

a.      If the ambient temperature is 32 degree Celsius, what is the voltage of the sensor’s output? (3 pts)


#include <homework_6_answer.h>
char i;
i = Q3_a_adc(32,2.56,0,2);



b.      What is the corresponding digital reading from the ADC output? (3 pts)


#include <homework_6_answer.h>
char i;
i = Q3_b_adc();


c.      If the digital reading is 300, what is the range of the analog value? Note that each digital number corresponds to a step (a small range in the span) of the analog value. (4 pts)

#include <homework_6_answer.h>
char i;
i = Q3_c_adc(300);



Question 4: ADC Design Principle (10 pts)

A 4-bit ADC (of 24 = 16 steps in the analog range) uses the Successive Approximation implementation. The input voltage range is 0.0V-16.0V. If the input is 5.0V, how does the ADC work out each bit of the digital encoding? Fill the following table to show the steps (as did in the class). The first step is given.

Step                Range                DN_Mid         AV_Mid(V)         Input >= AV_Mid
0                xxxx                1000                  8                   0
1                0xxx      
2
3
4

The digital value is__ Q4A_b() ___ (binary) and __ Q4A_d() ___ (decimal).

Question 5: ATmega128 ADC Programming (5 pts)

Describe in a few sentences how to use the ADSC bit in ADCSRA to start an ADC conversion, and to wait for the ADC conversion result to be ready.


Q5()

Question 6: ATmega128 ADC Programming (10 pts)

Assume ATmega128 platform with the system clock configured to 4MHz (for improved power efficiency). Write two C statements to configure the ADC as follows:
•      Interrupt enabled
•      One-shot mode
•      ADC clock rate in the range of 50K-200K Hz
•      Reference voltage is Vcc
•      No differential input
•      ADCW right adjusted
•      The initial input channel is 7

ADC_init()
{


Q6();

}


Question 7: ADC Programming (20 pts)

A Atmega128 is being used to monitor humidity inside test chamber 03. The device uses two sensors to have some fault tolerance.They are connected to ADC channels 0 and 1. The program uses the average and maximum error of the two values. Previously the program used interrupts to update the average and the maximum error of the two sensors, but recently the interrupts on the chip stopped working. GLaDOS has asked you to write code to do this with polling instead of interrupts.
Other notes:
         MaxError can only be set to a higher value
         The ADC has been initialized like the question above
         Using a spin lock to wait for ADSC to clear is ok.

Void updateHumidity(unsigned* maxError, unsigned* ave){
         //your code

                Q7();
}
main(){
         unsigned MaxError = 0;
         unsigned Ave = 0;
         init();
         while(1){
               updateHumidity(&MaxError, &Ave);

               // Somebody else’s problem
         }
}




if you want to buy <<CprE 288 Spring 2014 – Homework 6 Answer>>,please go to "www.taobao.com"
and find the shop that name is "what the hell is the homework answer " .
My name is red scarf , I'm pleased to help you, Now please pay me $50 for my work, thank you.

lgg88 发表于 2014-3-6 15:49:31

看的我眼花缭乱   。。算了 我不想那个钞票;

nazily215 发表于 2014-3-6 16:31:38

难道国外50元没人做才放到国内来?-_-

wingerchen 发表于 2014-3-6 16:38:14

呵呵。。。

北回归线 发表于 2014-3-6 16:40:43

nazily215 发表于 2014-3-6 16:31
难道国外50元没人做才放到国内来?-_-

做了一天还剩 最后一题
页: [1]
查看完整版本: 几道小题 哪位朋友闲了 帮忙做下 50元酬劳