Curriculum and Labs for Engineering Education

cancel
Showing results for 
Search instead for 
Did you mean: 

ME Lab 1 - Dice Game

Purpose:

This assignment is designed to allow you to practice basic programming techniques using loops and sequence structures, as well as to ensure that you understand how to do simple I/O operations with your data acquisition board.

Assignment:

Create hardware and software to simulate a single 6 dot die.  The program should have a front panel button that “rolls” the die, and the result should be displayed as both a number on the program front panel, as well as lighting the appropriate number of LED’s on your data acquisition card. 

This assignment is to be turned in as an individual assignment in engineering memo form, and demonstrated to your lab TA during your normal lab session.

Detailed Requirements:

Create a 6 LED display as shown in the following diagram.

Picture1.png

Create the required software blocks in LabVIEW such that each time a button on the front panel is pressed a new random number, between 1 and 6 is generated.  The output should light the appropriate number of LED’s starting at one end of the array, such that the number of LED’s lit is equal to the number displayed on the screen. The program should create a channel defining port 0 bits 0 through 5 as a single digital output channel to be written as a single word (as a single element integer 1D array).

Required LabVIEW VI blocks are:

DAQmx Create Virtual Channel

DAQmx Start Task

DAQmx Write

DAQmx Stop Task

DAQmx Clear Task

Random Number (0-1)

Note that there are a number of hint programs for this assignment are available below, which you are free to use, however if you use a hint, you must mark it on the grading sheet that you turn in with your report.  There is no penalty for using the hint, however you are encouraged to do so only if you are stuck.  As with any programming software, there are a wide variety of methods to accomplish the task you are given.  Feel free to explore and use any method you choose, so long as the required VI blocks are used.

This program should run when the run once button is pressed, and should continue to run until stopped by the user.  Each button press should result in one single roll of the die, and not continue to roll.

LabVIEW Resources:

For help with programming in LabVIEW please review the appropriate videos in our Learn to LabVIEW with MyDAQ Course.

Submission and Report:

The Report format for this assignment must be in engineering memo format. Include the description of how your program is constructed and functions, as well as comments about any problems, what portions of the assignment you found easy and what portions you found difficult.

The attachments should include the printout of the program VI Documentation including Front Panel, Block Diagram, Hidden Frames, and List of SubVIs and Express VIs.

The final page of the submission is to be the grading sheet provided below.


Contributors