ViSi: Date Input Validation with Keyboard
Introduction
This codebase example demonstrates how a keyboard object is used as an input interface for accepting a date string from the user. The program then parses the date string to find the month, day, and year information and convert them to their equivalent integer values. The month, date, and year information are then tested if they are valid and if they form a valid date.
To accomplish these, the program uses two functions:
andThe function parseDate(...)
extracts the month, day, and year information from stringDate and places them to the variables globalMonth, globalDay, and globalYear, 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 parseDateRoutines.inc
.
The function isValidDate(...)
checks the variables day, month, and year if they are valid and if they form a valid date. If the date is valid, it returns a "1". Otherwise, it returns a "0". This function is defined in the include file dateTimeRoutines.inc
.
Prerequisites
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.
Instructions
-
Compile the attached ViSi project and upload the program to a uLCD-32PTU (or your target display).
-
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.
-
The program should now run on the display module. See the video for more information.
Note
If unfamiliar with steps 1 and 2, see the application notes on the prerequisites.