Exercises

10.1 A 7-segment display is connected, as in Figure 10.2. Write a program to count the odd-numbered integers between 0 and 9 (i.e. 1,3,5,7 and 9) and display these numbers with 1 second intervals on the 7-segment display.

10.2 A 2-digit 7-segment display is connected, as in Figure 10.8. Write a program to count from 0 to 99 with 500 ms intervals and display the count on the 7-segment display.

10.3 Explain why a multiplexed 7-segment display should be refreshed in the timer interrupt service routine.

10.4 A 4-digit 7-segment display is connected, as in Figure 10.16. Write a program to count down from 1000 to 0, and display the count on the 7-segment display with 250 ms intervals.

10.5 A BM08M04N-R type 4-digit 7-segment display is connected to a microcontroller. Write a program to generate a random number between 1 and 1000 and display this number on the 7-segment display.

10.6 It is required to develop a dice program using a single digit 7-segment display. A push-button switch is connected to port pin RA0 of the microcontroller. Write a program to display a dice number between 1 and 6 on the display when the button is pressed. Describe how the program can be modified to display two dice numbers.

Get Using LEDs, LCDs and GLCDs in Microcontroller Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.