$30
1. Write a C program to interface the 3-dimensional accelerometer, ADXL335. Your program should sample x, y and z axes 5-times per second. Calculate the accelerations in terms of ‘g’ (Gravity of Earth) and send the samples to workstation. Samples should be sent such that they are displayed in UAH serial app as three separate lines. Please revisit the previous Lab 8 assignment to see how to use UAH serial app.
2. An accelerometer can be used in a car as a crash sensor to deploy airbags. When the magnitude of acceleration reaches some critical value (a crash was detected), a signal is sent to the airbag system. Modify the program from part 1 (do not remove any existing functionality), so that it calculates the magnitude using data from all three axes: 𝑀=
√𝑥2+𝑦2+𝑧2. If 𝑀 reaches the critical value of 2g, LED1 should turn on, emulating airbag deployment. SW1 should turn LED1 off, so that a new crash can be detected.
3. Write a C program that outputs different waveforms using DAC. It should have the following modes:
Switch Pressed
Waveform Displayed
None
Sine wave:
SW1
Sawtooth wave:
SW2
Half of the amplitude of the current wave form.
The waveforms will be viewed by connecting an oscilloscope to the output of DAC on MSP430. You should use MATLAB to create waveform lookup tables (LUTs) for the needed waveforms. These LUTs will be included as header files that are utilized by your main C program. For each signal, one period should have 512 samples and its frequency should be 25 Hz.
4. Read the following article about a method of quick magnitude estimation: https://dspguru.com/dsp/tricks/magnitude-estimator/. Implement it in C and think about how you can apply it to the 3D case. Replace the sqrt-based magnitude calculation used in part 1 with the new method. Is it faster than the original one? Support your conclusion by clock measurements (see Lab 1).