Skip to content

ViSi: Time Input Validation with Keyboard


This codebase example demonstrates how a keyboard object is used as an input interface for accepting a time string from the user. The program then parses the time string to find the hour, minute, and second information and convert them to their equivalent integer values. The hour, minute, and second information are then tested if they form a valid time. To accomplish these, the program uses two functions:

parseTime(var *timeString, var *globalHour,var *globalMinute, var *globalSecond)


isValidTime(var second, var minute, var hour)

The function parseTime(...) extracts the hour, minute, and second information from timeString and places them to the variables globalHour, globalMinute, and globalSecond, respectively. If the function was able to extract the required information, it returns a "1". Otherwise, it returns a "0". This function is defined in the include file

The function isValidTime(...) checks the variables second, minute, and hour if they are valid. If the variables are all valid, the function returns a "1". Otheriwse, it returns a "0". This function is defined in the include file

If you wish to learn more about the parseTime(...) function, refer to the codebase example

4D-CD-00042 Designer or ViSi Routine for Parsing a Time String

On the other hand, if you wish to learn more about the function isValidTime(...), refer to the codebase example:

4D-CD-00023 Designer or ViSi Time and Date Validation


The blinking underscore cursor functionality is made possible through the use of the routines in the include file blinkCursorRoutines<rev no.>.inc. To know more about this functionality, refer to the codebase example:
4D-CD-00040 ViSi Keyboard Input Interface with an Underscore Cursor


This codebase example assumes the reader can program the 4D Systems display module using Workshop4 IDE ViSi environment. Beginners are advised to read the following aplication notes.


  1. Compile the attached ViSi project and upload the program to a uLCD-32PTU (or your target display).

  2. In step 1, Workshop4 will ask for a uSD card to which the graphics or supporting files will be copied. Mount the uSD card to the PC, copy the files, unmount the uSD card from the PC, and mount it to the display module.

  3. The program should now run on the display module. See the video for more information.


If unfamiliar with steps 1 and 2, see the application notes.


Project File