Page 1 of 1

Writing a display DLL, what the functions do.

Posted: July 9th, 2007, 1:49 pm
by Fast351
You can get the Delphi framework from the CVS source repository by just looking at any of the multiple display driver sources there.

Enrico74 posted the VC++ version of the framework here:

http://forums.lcdsmartie.org/viewtopic.php?t=1415

Your display DLL may implement as few or as many functions as you wish to support. Not implementing the function will simply cause LCD Smartie not to call those functions. As a MINIMUM though, you should implement the Init, Done, SetPosition, and Write functions to get an LCD up and running. The others are optional.

Here is a brief document that describes each function:

Function: DISPLAYDLL_Init

Parameters: SizeX,SizeY : byte; StartupParameters : pchar; OK : pboolean;

Result: none

Function description: First function called when LCD Smartie starts a display
or comes back from standby. First two parameters are bytes that describe the
size that LCD Smartie believes the display to be, the third parameter are the
startup parameters as a null terminated string, and the fourth parameter is a
pointer to a boolean that the DLL can use to pass back success or failure of
DLL startup. (For example, if the calling application, LCD Smartie, wants the
driver to start a COM port that doesn't exist, pass back false to indicate the
start of the COM port failed).


Function: DISPLAYDLL_Done

Parameters: None

Result: none

Function description: Called when LCD Smartie closes the display to enter
standby or close the application


Function: DISPLAYDLL_SetPosition

Parameters: X,Y : byte

Result: none

Function description: Tells LCD where to position the cursor for the next
display command. For example, when LCD Smartie wants to update the second
line on the display, it will call this command with 1,2 parameters. The
coordinates are "1" based, meaning the upper left corner is 1,1.


Function: DISPLAYDLL_Write

Parameters: Str : pchar

Result: none

Function description: Write the null terminated string at the current
cursor position. This is the primary function LCD Smartie uses to write to
the display.


Function: DISPLAYDLL_CustomChar

Parameters: Chr : byte; Data : TCustomArray

Result: none

Function description: Defines custom char (CGRAM) for the display. The
first parameter is which character is being defined. The value is 1 to 8.
The next parameter is an array of 8 bytes that define the custom character.
Please note that when defining custom characters, only the least significant
five bits are effective (5x8 char).


Function: DISPLAYDLL_ReadKey


Parameters: none

Result: 16-bit word

Function description: This function attempts to read a keypad attached to the
LCD. This is a polled function, not an interrupt driven function, so it will
be up to the DLL to resolve multiple keypresses in a polling interval. Pass
back a failed keyscan (no key is pressed) by setting the high byte to 0xFF.
If the MSB is zero, LCD Smartie will assume the keyscan was successful, and
the data in the low byte will indicate the key.


Function: DISPLAYDLL_SetBacklight

Parameters: LightOn : boolean

Result: none

Function description: First parameter is an 8 bit boolean that tells the DLL
whether to turn the backlighting on or off.


Function: DISPLAYDLL_SetContrast

Parameters: Contrast : byte

Result: none

Function description: First parameter tells display DLL what contrast value
LCD Smartie wants, as set by the user in the setup screen. Default value is
128, values range from 0-255. Typically only used on LCD displays.


Function: DISPLAYDLL_SetBrightness

Parameters: Brightness : byte

Result: none

Function description: First parameter tells display DLL what brightness value
LCD Smartie wants, as set by the user in the setup screen. Default value is
128, values range from 0-255. 0 is dim, 255 is max brightness. Typically
only used on VFD displays.


Function: DISPLAYDLL_PowerResume

Parameters: none

Result: none

Function description: Called when power resumes from standby. NOTE: This
function is currently NOT implemented in LCD Smartie, and is there for future
expansion only.


Function: DISPLAYDLL_SetGPO


Parameters: GPO : byte; GPOOn : boolean

Result: none

Function description: Updates General Purpose Output (GPO). Supported by
Matrix Orbital displays. First parameter is which GPO to set, second
parameter sets on or off state.


Function: DISPLAYDLL_SetFan

Parameters: T1,T2 : byte

Result: none

Function description: Updates fan controller. Supported by Matrix Orbital
displays.


Function: DISPLAYDLL_CustomCharIndex

Parameters: Index : byte

Result: 8-bit byte

Function description: This allows LCD Smartie to preprocess the write data
when it contains custom (CGRAM) characters to contain the correct characters.
Historically, LCD Smartie used 176,158,131,132,133,134,135,136 for the CGRAM
characters because it allowed the on screen font to display certain characters.
Most LCD displays use either 0-7 (with a duplicate at 8-15) or 128-135. When
LCD Smartie starts the display, it will ask for what values to use by passing
in the Index (1-8) and using the 8 bit result from this function to substitute
for the default CGRAM characters. Note that if the LCD display uses 0-7, with
an 8-15 overlap, 8-15 should be used, since 0 will terminate the null string
passed in the write procedure. Not overriding this function will result in
LCD Smartie passing the default 176,158,131,132,133,134,135,136 characters for
custom CGRAM characters.

Posted: July 20th, 2007, 7:03 pm
by rfryar
You forgot these functions:
Function: DISPLAYDLL_Usage
Parameters: none
Results: Usage : pchar;
Cunction description: Returns plugin usage hints.
The usage text describes the main plugin parameters and how they are assembled
in the parameter string (syntax indications).

Function: DISPLAYDLL_DefaultParameters
Parameters: none
Results: DefaultParameters : pchar;
Function description: Returns the plugin default parameters.
The default parameters string is used as parameter string after the driver
has been initialized.

Thanks for the write up!

Rick
rickf@mindless.com

Posted: April 6th, 2008, 3:36 pm
by Bitlord
Could someone explain HOW to use this.

I am trying to make a plug-in for a VFD using COM2, 9600 baud,n,8,1
It's a 2x16 character VFD using 5x7 dot matrix characters via a serial interface controller (via COM2).
None of the standard plugins seem to work well...
Since the VFD is a costum job from Futaba Corp for Medion, I don't now wich chip it uses, but it should be verry close to the M162MD04AA, you can find the chips,.. for that on the internet (but not for the M18ST05A (model number for the VFD i'm using)).

Please tell me wich parrameters I have to fill in and how (hexadecimal location or just COM2, display usage 9600 or somting else,...)