Our new official repo is on github
LCD Smartie version 5.6 is released!
Download it now: https://github.com/LCD-Smartie/LCDSmartie/releases

C++/VS2005 Display plugin skeleton

Discussing issues that occur during plugin development.

Moderators: _X7JAY7X_, caesar, IFR, mattcro, limbo

Post Reply
Enrico74
Posts: 5
Joined: July 2nd, 2007, 4:17 pm
Location: Belfort, France

C++/VS2005 Display plugin skeleton

Post 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.
You do not have the required permissions to view the files attached to this post.

TiTaN_pi8
Posts: 1
Joined: August 7th, 2007, 7:22 pm

Post 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.
You do not have the required permissions to view the files attached to this post.

Nick_Shl
Posts: 5
Joined: November 6th, 2007, 11:16 pm
Location: Minsk, Belarus

Post 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.

mattcro
Forum Supporter
Posts: 590
Joined: March 8th, 2006, 1:58 pm
Location: Scotland

Post 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...

Nick_Shl
Posts: 5
Joined: November 6th, 2007, 11:16 pm
Location: Minsk, Belarus

Post 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

mattcro
Forum Supporter
Posts: 590
Joined: March 8th, 2006, 1:58 pm
Location: Scotland

Post 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?

Nick_Shl
Posts: 5
Joined: November 6th, 2007, 11:16 pm
Location: Minsk, Belarus

Post 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).

mattcro
Forum Supporter
Posts: 590
Joined: March 8th, 2006, 1:58 pm
Location: Scotland

Post 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).

Post Reply