CS计算机代考程序代写 algorithm compiler Exercise Questions:

Exercise Questions:
Assume your microcontroller clock speed to be 1MHz, unless stated otherwise. Q1. Explain about each type of register associated with the following I/O device:
– Digital (parallel I/O) – USART
– ADC
Q2. Explain the initialization parameters of the following I/O device: – USART
– ADC
– Timer
Explain why it is necessary to initialize each of these parameters.
Q3. A 10-bit analog-to-digital converter (ADC) has input range 0 – 5V. It is connected to an input coming from a sensor whose characteristics is as follows:
– Voltage range: 0 to 10 milli volts.
– Fundamental frequency 8KHz Your tasks:
i) Explain how you would implement a signal conditioning circuit for this situation
ii) Estimate the space required to store a minute of sensor data
iii) Estimate the accuracy of your ADC
iv) Repeat (i) above if your input is in the range 0 – 100 Volts
Q4. It is desired to program a timer to control a blinking LED. The LED shall blink ON and OFF every 5 seconds. Explain how you would set up a timer on your ATMega microcontroller using:
i) Timer0 ii) Timer1
Q5. Your microcontroller is used to control a dimmer. Right now, it is desired to set the input of the dimmer to 3.5Volts and 2 volts every 5 seconds. (Assume your microcontroller logic HIGH output is 5V). Explain how you would programmatically implement the dimmer using
i) Time0 ii) Timer1.

Q6. Your microcontroller is connected to a remote device and is programmed to work as a USART receiver. It is desired to receive and store data of unknown length in the microcontroller’s memory. Additionally, the receiver has the following parameters:
– Baud rate: 4800bps
– Parity: odd
– Number of stop bits: 2
– Operation mode: normal – Usage: receiver only
Implement a receiver code for the above task using interrupt.
Q7. Explain the difference between algorithmic and compiler optimization.
Your microcontroller is part of a weapon system used for tracking and destroying hostile objects. It has
the following two sensors:
– A reflectometer which estimates the distance D of an incoming object. – A tilt sensor used to read the tilt angle Ꝋ of the launcher.
The tracking equations are as follows:
X = square root of [ D + 2*(sin(Ꝋ)/0.05)]
If 1/(0.2X) > 0.5 object is targeted successfully;
otherwise change tilt angle until object is targeted correctly.
Some facts about this system:
– The range (distance) estimator (reflectometer) data is available every 0.4sec – The distance of the object D is 5-10kms.
– The tilt sensor output Ꝋ is available every 0.5msec
– Tilt angle in the range 0-90 degrees.
– Tracking/targeting should be updated every 1msec (hard deadline).
Explain how you would optimize your code to ensure that the deadline is met. How would your optimizations appear in your code?