ViSi: Displaying Large Integers with the LED Digit Object
Introduction
The PICASO and DIABLO-16 are 16-bit processors, and signed number operation with 16-bit integers limits the maximum number that can be displayed by LED digits objects to "32,767". 2^16 equals 65,536. Divide this by two since the first half is used to represent positive numbers; the remaining half is used to represent negative numbers. Thus, attempting to create a 6-digit LED digits object or to make a LED digits object display a value beyond the limit results to red "X" marks on the object during runtime. To be able to display a value higher than "32,767" in ViSi, one solution is to use the string format specifiers of 4DGL strings. This is in combination with the 4DGL math functions for operating on 32bit integers.
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 it to a uLCD-32PTU (or your target display). Copy the supporting files to a uSD mounted to the PC. Properly unmount the uSD card from the PC and mount it to the uLCD-32PTU.
Note
- The attached project has two LED digits objects. If you intend to add more LED digits objects to the project, you need to edit the constant "N_MAX" and the data block "uSDidx". If you add two LEd digits objects to the project for instance, then you would write:
#constant N_MAX 4 // we have four LED digits objects
#DATA
word uSDidx
iiLeddigits0,
iiLeddigits1,
iiLeddigits2,
iiLeddigits3
#END
- Also you will need to use the function
setProperties(...)
for each new LED digits object. Read the comments in the code.
- The program should now run on the display module.