Page 1 of 1

C++/VS2005 Display plugin skeleton

Posted: July 6th, 2007, 12:29 pm
by Enrico74
Hello,

I wanted to start the development of a display driver for the VFD of my case (Zalman HD135) but could not find any skeleton to start with.
So I first tried to build a proper C++ skeleton with VS2005 and got to the point where I think I could share it with the forum.
It can certainly be improved / correted / documented... but for now it just seems to do the job for my purposes (and maybe yours).

It comes with project files to be compiled with VS2005 (express edition should work) and a sample plugin.dll that can be loaded with LCDSmartie 5.4 (I did not try with any other versions).

Please post comments and suggestions.

Posted: August 7th, 2007, 7:29 pm
by TiTaN_pi8
Very nice initiative!

I tried to load the solution file (plugin.sln) but I got an error about a file not found. I looked through the project file and found an absolute path from your machine. If you remove the line 'InheritedPropertySheets="..\..\..\..\Tronc\Ressources\Options communes BestOptim.vsprops"' twice (line 23 and 104) it works without errors.

I have attached the entire skeleton with edited project file.

Posted: November 6th, 2007, 11:28 pm
by Nick_Shl
Hi!
I am want to write my own LCD driver. I am compiled this code with Visual C++ 6.0, but it isn't work. In display settings "Warning: DLL may not compatible!".
If I change string

Code: Select all

#define DLL_EXPORT(type) extern "C" __declspec(dllexport) type __stdcall
to

Code: Select all

#define DLL_EXPORT(type) extern "C" __declspec(dllexport) type
It work(show correct plugin name, usage and param), but if click button "OK" or "Apply", Smartie closing without any error...
Please help me.

Posted: November 7th, 2007, 11:31 am
by mattcro
You may need to manually add/create a DEF resource file that lists the functions to be exported from the DLL. This looks something like this:

Code: Select all

LIBRARY	"JW002_LCD"

EXPORTS
  DISPLAYDLL_Init
  DISPLAYDLL_Done
  DISPLAYDLL_DriverName
  DISPLAYDLL_Usage
  DISPLAYDLL_DefaultParameters
  DISPLAYDLL_SetPosition
  DISPLAYDLL_Write
  DISPLAYDLL_SetBrightness
  DISPLAYDLL_CustomChar
  DISPLAYDLL_CustomCharIndex
  DISPLAYDLL_ReadKey
  DISPLAYDLL_SetBacklight
  DISPLAYDLL_SetContrast
  DISPLAYDLL_PowerResume
  DISPLAYDLL_SetGPO
  DISPLAYDLL_SetFan
The LIBRARY line must refer to the project name ("JW002_LCD" in my case). This file should be added as a project resource.

I hope I've got that all right, since I'm not in front of a project at the moment to check...

Posted: November 7th, 2007, 1:48 pm
by Nick_Shl
mattcro wrote:You may need to manually add/create a DEF resource file that lists the functions to be exported from the DLL. This looks something like this:
...
The LIBRARY line must refer to the project name ("JW002_LCD" in my case). This file should be added as a project resource.
I hope I've got that all right, since I'm not in front of a project at the moment to check...
Yes! All Right! Big thanks!
Image
Image

Posted: November 7th, 2007, 8:55 pm
by mattcro
Hey, look! I'm famous :lol:

Glad to hear you have the driver working now. The FTDI-based module looks interesting. I've used the FT232 but not the parallel FIFO ones. Do you have a microcontroller under the board there somewhere, or is it just the USB converter and LCD?

Posted: November 8th, 2007, 11:36 am
by Nick_Shl
mattcro wrote:Glad to hear you have the driver working now. The FTDI-based module looks interesting. I've used the FT232 but not the parallel FIFO ones. Do you have a microcontroller under the board there somewhere, or is it just the USB converter and LCD?
I am use this chip without microcontroller. FT232 also can be used without microcontroller, because I am using "Bit-Bang Mode"(FT232BM/FT245BM Bit-Bang Mode) for control LCD in 4bit mode(D0-D4, E, R/W, A0, R/W now not using - always write. 1 line free, maybe use it in future for control backlight).

Posted: November 8th, 2007, 5:02 pm
by mattcro
Ah, didn't realise there was a bit-bang mode. That makes it very easy to hook up an LCD with USB if you use the DLP module.

For 4-bit LCD mode, you have D0-D3, RS and EN (plus EN2 on 40x4). That's two spare pins (or 1 spare on 40x4), so you can have backlight control on all LCDs, and maybe a GPO (or single button).

When you are happy with the driver, please share it by starting a new thread in the plugin announcements section with some info and the driver (plus source code if possible).