Designer or ViSi: Parse and Check a Time String
Introduction
This codebase example shows how to parse a 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 for validity. To accomplish these, the program uses two functions:
and
The function parseTime(...)
extracts the hour, minute, and second information from timeString and places them to globalHour, globalMinute, and globalSecond, respectively. If the function could extract the required information, it returns a "1". Otherwise, it returns a "0". This function is defined in the include file parseTimeRoutines.inc
.
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 dateTimeRoutines.inc
.
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
Prerequisites
This codebase example assumes the reader can program the 4D Systems display module using Workshop4 IDE ViSi or Designer environment. Beginners are advised to read the following aplication notes.
Instructions
-
Modify the input time string on line 22 in the attached Designer code. Compile and upload the project to a uLCD-32PTU (or your target display).
-
The program should now run on the display module. See the video for more information.