Assignment 5

Digital Clock - Phase 2*


Introduction

In this assignment we will build on what we did with the digital clock in the previous assignment. In this phase we will now make the clock a "binary one". You will be implementing a digital clock as shown below.

Details

The clock is a single form VB application. The hours, minutes and seconds indicators are any component of your choice. You might consider using the following layout:

In this example, buttons have been used for the HMS indicators with OptionButtons used for the AM/PM indicator. the time shown on the example clock is 10:23:48 AM. For the buttons the caption property has been set to the null string ("") and the BackColor has been set as appropriate. You may also want to consider adding a 12/24 hour feature.

The hours, minutes and seconds indicators need to be updated (perhaps every second) with the current time. The current time from VB can be retrieved using the Time function:

Time Function - Returns a Variant (Date) indicating the current system time.

Getting Binary Values

In the previous proiject, you gathered to the digits from the Time function and updated the display. Here you will have take those digits, convert them to a numeric value and use integer division and modulus to get the binary values. The following approach is one way to get the digits:

    Dim binary1 As Integer
    Dim binary2 As Integer
    Dim binary4 As Integer
    Dim binary8 As Integer
    dim Value as Integer
    Value = 11
    
    binary8 = Value \ 8
    Value = Value Mod 8
    binary4 = Value \ 4
    Value = Value Mod 4
    binary2 = Value \ 2
    binary1 = Value Mod 2

What You'll Turn In:

    a diskette containing your code (be sure and include any graphic images as well), clearly labled with:

Name your project mp05.prj and your form mp05.frm


* binary clock picture from http://www.thinkgeek.com