Lab 07a - Dice

Lab 07a - Dice - Lab 7a Dice Roller "Write a dice...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
BYU CS/ECEn Dice Lab 1 Lab 7a – Dice Roller "Write a dice roller C program that waits for a switch to be pressed and then displays two dice which randomly change values. The dice roll begins rapidly and progressively slows down until it stops (after approximately 3-5 seconds). A congratulatory ditty is played when doubles are rolled. If doubles are rolled twice in a row, output a raspberry tone. Write an assembly language function which returns a random number from 1 to 6 and call this function from your C program."
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
BYU CS/ECEn Dice Lab 2 Lab 7a – Dice Roller n Goals n Learn how to write C functions. n Learn how to use C header files. n Learn how to implement control and iterative statements in C. n Learn how to interface a C program with an assembly function. n Learn how to control a liquid crystal display from C. n Learn how to draw graphic objects and text on the LCD. n Learn more about function frames.
Background image of page 2
BYU CS/ECEn Dice Lab 3 Lab 7a – Dice Roller 1. Write your dice roller in C and call an assembly subroutine to return a random number. 2. Initialize your MSP430 processor clock speed at 8 Mhz and blink the green LED at 1 second intervals. 3. Write an assembly subroutine to return a random number between 1 and 6 (inclusive). Initialize the random number generator seed before requesting a random number. 4. Wait for any switch to be pressed, then clear the screen and start your dice rolling. 5. Repeatedly get two random numbers ranging from 1 to 6 and display these values as two dice on the LCD. 6. Begin with a rapid dice roll but progressively slow down the roll until it stops and wait for another switch to be pressed. (Make the total roll time approximately 3-5 seconds.) 7. With each change of the dice, blink the backlight and output a low tone. At the end of a roll sequence, sound another higher tone. 8. If the dice roll results in doubles, output a congratulatory ditty. If doubles are rolled twice in a row, follow the congratulatory ditty with a raspberry tone. 9. Finally, after the dice roll, display a text message asking the user to roll again. 10. Turn the LCD backlight off the after 5 seconds of inactivity.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
BYU CS/ECEn 124 The C Language 4 RBX430-1 LCD Y (0-159) f Hello World! // 5 x 8 pixel Characters lcd_cursor(40, 60); lcd_printf("Hello World!"); X (0-159) f 160 x 160 x 5 pixels display
Background image of page 4
Dice Lab 5 eZ430X LCD n LCD - 100 x 160 pixels display X (0-159)  Y (0-99)  Page 10 Page 9 Page 8 Page 7 Page 6 Page 5 Page 4 Page 3 Page 2 Page 1 Page 0 Page 12 Page 11 Page 13 Hello World! // 5 x 8 pixel Characters
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 15

Lab 07a - Dice - Lab 7a Dice Roller "Write a dice...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online