搜索
bottom↓
回复: 11

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

[复制链接]

出0入0汤圆

发表于 2014-3-6 14:40:42 | 显示全部楼层 |阅读模式
题不多 哪位朋友做了80分以上  钱不多 50话费 或者直接打支付宝   
要求80分以上  绝不食言 截止到今晚上 8点 (2014/3/6)
或许有人说 大神写个流水灯也得上万  对此不多说
QQ : 137740979

阿莫论坛20周年了!感谢大家的支持与爱护!!

知道什么是神吗?其实神本来也是人,只不过神做了人做不到的事情 所以才成了神。 (头文字D, 杜汶泽)

出0入0汤圆

 楼主| 发表于 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. [10] 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. [10] 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
        }
}

出0入0汤圆

发表于 2014-3-6 14:44:03 | 显示全部楼层
呵呵。            

出0入0汤圆

发表于 2014-3-6 14:46:20 | 显示全部楼层
国外,作业?

出0入54汤圆

发表于 2014-3-6 14:47:56 | 显示全部楼层
都不好好整理一下,这。。。。。。
这里的人都不傻,楼主

出0入0汤圆

 楼主| 发表于 2014-3-6 14:49:07 | 显示全部楼层
mhw 发表于 2014-3-6 14:46
国外,作业?

嗯                                   

出0入0汤圆

 楼主| 发表于 2014-3-6 14:50:25 | 显示全部楼层
mutoudonggua 发表于 2014-3-6 14:47
都不好好整理一下,这。。。。。。
这里的人都不傻,楼主

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

出0入0汤圆

发表于 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. [10] 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. [10] 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.

出0入0汤圆

发表于 2014-3-6 15:49:31 | 显示全部楼层
看的我眼花缭乱   。。算了 我不想那个钞票;

出0入0汤圆

发表于 2014-3-6 16:31:38 | 显示全部楼层
难道国外50元没人做才放到国内来?-_-

出0入0汤圆

发表于 2014-3-6 16:38:14 | 显示全部楼层
呵呵。。。

出0入0汤圆

 楼主| 发表于 2014-3-6 16:40:43 | 显示全部楼层
nazily215 发表于 2014-3-6 16:31
难道国外50元没人做才放到国内来?-_-

做了一天还剩 最后一题  
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片。注意:要连续压缩2次才能满足要求!!】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-7-24 00:25

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表