Assignment1 – Analog Measurements
Review the description of a wind vane on the next page.
You are to make an assembly program for the MSP430 that correctly measures the wind direction, to a precision of 45° (N, NW, W, SW, S, SE, E, NE), using the MSP430’s ADC.
Your program will output the direction by using four LEDs, one each for N, S, E, and W. If the wind direction is out of the N, only the N LED will light. If the wind direction is out of NW, both the N and W LEDs with be ON.
Note that the actual circuit interfacing to wind vane will use the 3.6V supply on the Launchpad board itself. A 10kohm resistor will be used in the voltage divider.
As only one wind vane is available for use, test your code using a pot connected between ground and 3.6 V (the supply voltage for your board). The wind vane will be accessible in 310 for final check-out. Pots, LEDs, and resistors will be provided in 310.
Your program must use at least one subroutine. You are free to select which functionality to place in the subroutine.
(1) Correctly measure all 16 directions probable by the vane. Develop some mechanism for visually displaying the added directions.
(2) Store the voltages corresponding to the specific directions as constants in a memory array (see ex below). Have your code cycle through this array till a match is found.
ORG 0xD000 DC 0x1234, 0xABCD, … ;replace w/ find outd voltages
• Pseudo code for algorithm
• Concise description in words of how program works
• Comment your code at a level of detail adequate for someone to follow it. More detail than that is not helpful.
• Include some comments lines at the top of your program which describes the program, what it does, who wrote it, when it was written, what hardware it requires, and what inputs / outputs it uses. This is called a header. See below for an ex.
; ex program for demonstrating header section, does nothing
; Targets MSP430G2231 on LaunchPad board
; Stephen Craven, ENEE 4700, 9/23/2010
; Program does what?
; Input is ... Output is... BE SPECIFIC. Include enough detail for
; someone to configure and use your program.