Problem Weight Score 15 24 16 20 17 30 18 36 19 20 Total 130
Problem Weight Score 15 24 16 20 17 30 18 36 19 20 Total 130
Problem Weight Score 15 24 16 20 17 30 18 36 19 20 Total 130
Lab Section:
Submission deadlines:
• Turn in the written solutions for the problem set by 4:00 pm Monday 8 October in the homework slot outside
121 EE East. You also must submit all the code you are asked to generate, packaged in a zip file, to the Canvas
dropbox for this assignment by 4 pm Monday 8 October.
The solution submitted for grading represents my own analysis of the problem, and not that of another student.
Signature:
Neatly print the name(s) of the students you collaborated with on this assignment.
Problem 15: (24 points)
The security of a cipher lock is, in part, centered around the number of possible combinations. For our cipher lock
as implemented in Project 1, the security isn’t very good; our cipher lock has only three valid digits and can only
accept a three digit code. This means there are only 27 possible combinations, making the lock easy to defeat using
a simple brute force attack (trying all the combinations). In order to improve the cipher lock’s security, we will
increase the number of input buttons to four; this gives us access to up to 15 digits, plus zero which we will still
reserve for a ”do nothing” input. We will denote the additional buttons as B2 and B3. We will also increase the
number of digits in our combination to four digits. In order to track the new state we are adding, we will also need
to add an additional output LED we will label C.
Your lock code will be unique; each student will use the numerical portion of their PSU User ID as their code.
Most of your have a four digit numerical portion, however, if you don’t, you can pad the numerical portion with the
numbers 7, 8, 9 as needed. In my case, my PSU User ID is map244. So, I would pad the numerical portion of my
PSU User ID with 7, giving me my cipher code 2447. If your numerical portion is two digits, say 12, you would use
the code 1278; likewise if your numerical portion is only one digit, say 5, you would use 5789.
1. (4 points) Determine the number of possible combinations that can be be recognized by the cipher lock.
2. (10 points) A partially complete state transition diagram is provided in Figure 11. Complete the diagram using
your unique code and include it with your solutions.
3. (10 points) Use your state transition diagram results to complete the provided State Table started in the Excel
file included with this problem set. Print your result and include it with your solutions.
F [n] = F [n − 1] + F [n − 2]
where n is an integer and n ≥ 0. While the recursion works with any initial values, Fibonacci’s numbers are produced
with F [n − 1] = 0 and F [n − 2] = 1. Included with this problem set is starter code that generates the 43th Fibonacci
number. Modify the starter code so that:
1. It uses the initial conditions F [n − 1] = 7 and F [n − 2] = 1.
2. In addition to displaying 43rd value in the sequence, the front panel also displays the sum of the even terms of
the sequence through the 43rd term.
3. The program should save the value n, F [n], and the sum of the even sequence values through n for each value
from zero to 42. Format the width of n to two digits while the other two numbers should be formatted to
twelve digits. Your output should resemble Figure 1.
In your written solutions include a print out of your text file.
1. (5 points) After the VI in in Figure 2 completes execution, which graph in Figure 3 matches the output in the
Waveform Graph indicator? Explain your reasoning in a paragraph.
2. (5 points) Figure 4 shows two approaches for plotting multiple curves using a Waveform Graph indicator. The
indicators Waveform Graph 1 and Waveform Graph 2 in Figure 4 display identical results. For each of the five
wires labeled A through E in Figure 4, answer the following questions.
• Does the wire represent an array or cluster?
• If the wire represents an array, what is the data type of the elements, the dimensions of the array, and
the number of elements per dimension?
• If the wire represents a cluster, what are the data type of the elements of the cluster?
3. (5 points) Figure 5 shows a VI that writes a 1D array of eight Booleans to disk. Determine the size of the
saved file in units of bytes. To receive credit, you must state in one or two sentences how you determined the
size. No credit will be given if you simply state the value by executing the code and checking the file size on
disk.
4. (15 points) Consider the VI in Figure 6. Answer the following questions, and support your answer with one or
two short sentences.
(a) (3 point) Immediately before the While-Loop structure executes, what value does the loop iteration counter
display?
(b) (2 point) For what values of the Loop Iteration indicator is the stop button visible?
(c) (2 point) For what values of the Loop Iteration indicator is the stop button blinking?
(d) (2 point) What is the background color for the Loop Iterations indicator?
Figure 4: VI for Problem 16 Part 2.
(e) (2 point) For what values of the Loop Iteration indicator is the numerical text red?
(f) (2 point) For what values of the Loop Iteration indicator is the numerical text blue?
(g) (2 point) Are the property nodes within the case structure implicitly or explicitly linked to the Loop
Iteration indicator?
Figure 6: VI block diagram for Problem 16 part 4.
Forcing the order of execution using a flat sequence structure is a useful tool for benchmarking code performance.
Using a flat sequence structure along with tick count function nodes allows the user to determine the execution time
of code appearing within a sequence frame. As an example, Figure 7 shows two methods for creating a 1D array of
32-bit signed integers. One approach uses a for loop, while the second uses a while loop. It turns out that one of
these approaches takes less time to execute than the other; this is true even if we add an Equal? function node in
the for loop to balance out the time required by the similar function in the while loop. In this exercise, you will use
the flat sequence structure to determine execution time of both loop structures
Figure 7: Measuring the execution time of a for loop versus while loop.
1. (5 points) The for loop and while loop structures use auto-indexing tunnels to generate 1D arrays of signed
32-bit integers. Assume the value for N is set to be 8,000,000. How many elements are in the 1D arrays
displayed by the indicators labeled output 1 and output 3?
2. (6 points) Describe what the indicators labeled output 2 and output 4 display. What units should be included
in a label for these outputs?
3. (6 points) Does the execution time of the function node Decrement, that appears outside the sequence structure,
affect the values displayed by the indicators labeled output 2 and output 4? Justify your answer using one or
two sentences.
4. (16 points) Code and execute the sub VI shown in Figure 7. Create a VI to automate the measurement of
an average of the loop execution time. Place the sub VI into a for loop and execute the loop eleven times.
Initialize the sub VI using the code snippet in Figure 8; this code makes a small change to the size of the array
created by the sub VI for each iteration. Use the loop to generate arrays of the run times for both the for and
while loops in the sub VI. Determine the maximum and minimum execution time for each of the loop types.
Exclude the first measured time and compute the average execution time for each of the loop types. Your front
panel should look similar to Figure 9. Record your minimum, maximum and average time for both the for and
the while loops in your written solutions. Submit your code through Canvas. Manually verify that your code
is computing the minimum, maximum and average correctly.
5. (3 points) Based on your answer in part 4, which loop structure is more efficient?
The block diagram shown in Figure10 is designed to use the DAQmx functions to generate an audio output. It will
generate a standard music tone A above middle C, 440 Hz, for 3 seconds. Implement the block diagram. Connect a
pair of headphones to the audio out connector on your myDAQ and verify that you hear a tone in one ear and not
the other.
1. (4 points) Explain the purpose of the constants used with the Create Channel VI.
2. (4 points) Explain the purpose of the constants used with the Timing VI.
3. (4 points) The Write VI takes an array input that is generated in a for loop. What are the contents of the
array?
4. (8 points) The for loop that generates the array doesn’t mention the frequency of the sinusoid. How is the
frequency of the sinusoid, 440 Hz, determined?
S1
LCBA
B3 B2 B1 B0
S0 S2
LCBA LCBA
S4 S3
LCBA LCBA
B3 B2 B1 B0 B3 B2 B1 B0