General Information
Is it recommended to download/run the 4DGL program from the RAM during development stages?
Yes, it is desirable to download/run the program from RAM to eliminate unnecessary FLASH write cycles.
Note
Running programs from RAM is not applicable for Goldelox.
Why does the gfx_TriangleFilled command seem slower than drawing other filled shapes?
Drawing a filled triangle is handled differently in the PmmC since there are no display internal commands that allow fast filling of a triangle.
When I change the orientation of the display module, does the origin of the touch screen change?
Yes, with the change in orientation, the display origin as well as the touch screen origin changes accordingly.
Can I change the orientation of the display modules during runtime?
Yes, you can change the orientation in run time. Here is an example code snippet:
Please note that this doesn't immediately rotate the contents of the screen and simply affects the next set of draw functions used.
See the Internal Functions Manual for the 4D processor of your display module for more details:
Can I call a .4XE or .4FN file from another .4XE or .4FN file?
No, you can't. You need to call down and return up. You can't 'jump' from one .4XE or .4FN file to another.
How can I use 4XE file as a child program?
A secondary (CHILD) 4XE file can be saved to the microSD card and called from the Main program that resides in the FLASH. Once loaded, a child 4XE file takes full control and runs from the RAM.
When you reach "Exit" in the 4XE file code, the module goes back to the start-up routine returning control to the Main Program in FLASH, in effect restarting it.
You can pass arguments to a 4XE file from the Main Program. The 4XE File cannot return anything to the Main program.
What is a 4FN File?
When you compile a 4DGL file that doesn't have a "Main" Function, a 4FN file is generated as relocatable source code. A 4FN file can be loaded, then called from the Main program that resides in the FLASH memory of the Processor.
It works just like a function and can be discarded when no longer required, freeing up memory. You can also pass arguments to a 4FN file from the Main Program. It can return values to the "Main" Program.
You can return from a 4FN file to the Main Program at the same point where you called the 4FN file.
Note
A good example of this technique can be found in the 4DTETRIS.4DG program which can be browsed through the Samples -> Picaso Designer -> PICASO - DEMO\EXECUTABLESSOURCE
What is a 4XE File?
When you compile a 4DGL file, the compiler generates an executable file with an extension .4XE. When you download the compiled code, the 4XE file gets downloaded to the FLASH or RAM depending on the option selected in the 4D Workshop4 IDE.
When a 4XE program is saved to FLASH, the program will start whenever power is applied.
Note
If #MODE RUNFLASH is added to the start of the program, the program actually executes from FLASH memory. Otherwise, the program in FLASH is loaded into RAM before it is run. A program that is run directly from FLASH runs a little slower than a program run from RAM but has the advantage of leaving the RAM space free for running child programs.
Can I use the display as a slave device?
Yes. All core display solutions (4D Systems modules that use 4D Systems processors, such as uLCD, uOLED, pixxiLCD, and gen4-uLCD products) are pre-programmed with SPE (Serial Platform Environment). This allows users to interface their favorite controller boards to the display without the need to program the display manually. In this setup, the display acts as a slave device.
It is also a good idea to consider using ViSi-Genie. This is a codeless Workshop4 environment that allows you to design your user interface that can allow widgets to be linked together. It accepts and processes write commands from the host controller and can also be configured to send reports during certain events.
Can I retrieve my program code back from the display module?
Unfortunately, once the program is written in the flash memory it can no longer be read back. For any program stored in the microSD or external flash in the form of 4XE or 4FN file, it is also difficult for it to be disassembled into anything that close enough to resemble the source code.
How can I update my display to the latest PmmC and/or Driver?
You need to open PmmC Loader tool by doing any of the following:
- From Workshop4 IDE
- Open or create a project.
- Go to Tools Menu and select PmmC Loader
- From Windows File Explorer:
- Navigate to C:\Program Files (x86)\4D Labs\4D Workshop 4 IDE\DEP
- Open EXE
Once you have this tool opened, you can either use Automatic or Manual mode. Usually, automatic should work without issues. However, if you do encounter any issues, you can try using Manual.
When using Manual mode, the PmmC and Driver files are located in:
C:\Users\Public\Documents\4D Labs\4DUpdates\PmmCs
Note
Driver files are only applicable to Diablo displays
Can I retrieve my project from the display?
No, you can't. To protect the project from being copied, the display doesn't allow reading the program binary.
When creating a project, it is always best to keep a copy of your source files, or at least the generated 4XE and CFG files during compilation or upload.
I am entirely new to programming. Any advice on where to start?
It can be a bit difficult to get started on programming. Like any other platform, it can take a while to gain a good grasp of programming in 4DGL.
We would recommend you take it slow and study programming in general rather than jumping ahead to learn our programming language. Even though 4DGL was designed to be easy to learn, it still requires that you have a good understanding of common programming topics and relevant programming experience as well.
The best path for you might be to study programming with Arduino since it is the simplest platform to learn. When you have a good grasp of it, try using ViSi Genie to design your user interface. This is a good place to start since in most cases, it doesn't require you to program in 4DGL.
Once you've gained enough programming knowledge and experience feel free to try programming in 4DGL.
Do I Need 4D System’s USB Programming Adapters or Cables?
To program the 4D Display module - Yes.
You will require a programming adapter or cable when updating PmmC and programming the display. This is usually included in Starter Kits and can also be purchased separately.
You cannot use other FTDI or generic programming adaptors, as most of them do not use the same reset technique required for 4D Processors, and will either not work correctly, or will 'brick' the 4D Processor. It is highly recommended you do not even attempt to try this at risk of damaging your module’s processor.
4D Programming Adaptors or Cables are available on the 4D Systems website, or from distributors.
Using the wrong programming cable or adaptor may damage your module and void your Warranty.
List of official 4D programming adaptors:
- 4D-UPA
- gen4-PA
- uUSB-PA5-II
- Programming Cable
- uUSB-PA5 (Legacy)
- uUSB-CE5 (Legacy)
- uUSB-CE5-2 (Legacy)
- uUSB-MB5 (Legacy)
Can I use a custom-made or third-party USB to Serial for programming?
No, you shouldn’t use a third-party USB to Serial converter. Custom made, please see note below.
You cannot use other FTDI or generic programming adaptors, as most of them do not use the same reset technique required for 4D Processors, and will either not work correctly, or will 'brick' the 4D Processor. It is highly recommended you do not even attempt to try this at risk of damaging your module’s processor.
4D Programming Adaptors or Cables are available on the 4D Systems website, or from distributors.
Using the wrong programming cable or adaptor may damage your module and void your Warranty.
uUSB-PA5-II, 4D-UPA, Programming Cable, (Legacy - uUSB-PA5, uUSB-CE5, uUSB-CE5-2, uUSB-MB5)
Warranty Note:
PmmC/Firmware or user application code programming should only be carried out using official Programming Cables or Adaptors. Any malfunction because of custom or third-party USB to Serial converters or Serial (RS232) to Serial (TTL) level converters will void the warranty. It also applies to all 4D products which require an interface from the PC to the module for testing using 4D Software Test Tools. Using an incorrect programmer could 'brick' your module.
Custom Made:
If you have an application that requires you to have an on-board programmer, such as in a custom product, please contact our Support team, so the required information can be passed to you so you design can a programmer that meets the required specification for programming 4D Processors.
Is FAT format supported for the microSD?
Except for Goldelox, all 4D processor supports FAT.
Goldelox only supports reading the microSD card in RAW format.
The rest of the 4D processors support FAT16 which can take up to 4 GB space on the microSD. Any space more than that can still be accessed in RAW format just like in Goldelox.
What should I consider when selecting a microSD card?
All 4D devices that use microSD cards require cards that support the SPI protocol.
It is not ‘mandatory’ for manufacturers to support this protocol, but most do. Unfortunately, this is not usually explicitly labeled or shown, so it can be a challenge to find suitable cards.
For this, we highly recommend using our Industrial Grade cards, which support SPI and Read Disturb Prevention technology.
Is it possible to update the display PmmC from the uSD card?
No, the bootloader that loads the PmmC does not have the ability to load a PmmC from the uSD card.