I've just acquired a cheap surplus 8x24 alphanumeric LCD type HG12603-A (aka JW-002, see http://pjrc.com/tech/mp3/lcd_protocol.html and http://www.btinternet.com/~markd833/LCD/intro.htm) and am interested in developing a driver for it. I have a demo app running in VB.net to control it and want to port this to a Smartie driver. I'm getting into Visual Basic 2005 (express) for work and hobby stuff.
Does anyone have a Smartie driver framework for VB? I'll probably be able to work it out myself eventually, but it would give me a head start...
Our new official repo is on github
LCD Smartie version 5.6 is released!
Download it now: https://github.com/LCD-Smartie/LCDSmartie/releases
LCD Smartie version 5.6 is released!
Download it now: https://github.com/LCD-Smartie/LCDSmartie/releases
Anyone got a VB.net 2005 display driver framework/skeleton?
Moderators: _X7JAY7X_, caesar, IFR, mattcro, limbo
-
- Forum Supporter
- Posts: 590
- Joined: March 8th, 2006, 1:58 pm
- Location: Scotland
-
- Posts: 36
- Joined: July 17th, 2007, 2:12 pm
- Contact:
Well I originally had a VB display driver DLL written but I basically threw it away when I got visual c++. But here is how I started:
Look at the plugin DLL example for VB:
http://lcdsmartie.cvs.sourceforge.net/l ... netplugin/
Then look at the other drivers source that are not in VB for the methods:
http://lcdsmartie.cvs.sourceforge.net/l ... ll_source/
I may be able to dig out my VB source sometime tomorrow but I think I only have an incomplete test version
Rick
http://lcdsmartie.fryar.org/
Look at the plugin DLL example for VB:
http://lcdsmartie.cvs.sourceforge.net/l ... netplugin/
Then look at the other drivers source that are not in VB for the methods:
http://lcdsmartie.cvs.sourceforge.net/l ... ll_source/
I may be able to dig out my VB source sometime tomorrow but I think I only have an incomplete test version

Rick
http://lcdsmartie.fryar.org/
-
- Forum Supporter
- Posts: 590
- Joined: March 8th, 2006, 1:58 pm
- Location: Scotland
I've started on the driver in VB using that strategy - use the structure of the plugin project and replace the functions with display driver ones ported from the source in other languages.
I'll see how I get on, but if I can't get it to work well, I'll probably just stick with C++ (have VC++2005 installed too) since I've already used that a bit. I'm not especially competent at application development either language, having only done microcontroller and basic C so far...
I'll see how I get on, but if I can't get it to work well, I'll probably just stick with C++ (have VC++2005 installed too) since I've already used that a bit. I'm not especially competent at application development either language, having only done microcontroller and basic C so far...
-
- Forum Supporter
- Posts: 590
- Joined: March 8th, 2006, 1:58 pm
- Location: Scotland
Well, I've been tinkering with the various VB.net plugins that I have the source for, and can get an ordinary plugin compiled no probs.
However, I've had no luck with making a display driver dll in VB. Either I'm doing something wrong (very likely) or it's not possible to create the required format of dll in VB. What are the differences in calling/writing driver functions and plugin functions?
When I try to switch to the new driver in the LCDSmartie settings window, I get "Warning: DLL may not be compatible!" where the driver name/description normally appears, and "no parameters" where usage normally appears.
I get I don't know enough about the ins and outs of classes, libraries, namespaces, etc to know where I'm going wrong. I've simply used the demo VB plugin project and replaced the functions with the VB equivalent of the display driver functions. The VB plugin examples have the functions inside the LCDSmartie class. Should it be the same for a display driver?
Rick, if you do find the VB driver source I'd appreciate a look at it! Was that in VB6 or one of the standard/pro .NET editions? I wonder if the Express edition of VB2005 is rather limited for creating drivers like this...
I've attached the current source/project files for reference. Any hints welcome! I'm kinda jumping in at the deep end here as far as VB programming goes...
However, I've had no luck with making a display driver dll in VB. Either I'm doing something wrong (very likely) or it's not possible to create the required format of dll in VB. What are the differences in calling/writing driver functions and plugin functions?
When I try to switch to the new driver in the LCDSmartie settings window, I get "Warning: DLL may not be compatible!" where the driver name/description normally appears, and "no parameters" where usage normally appears.
I get I don't know enough about the ins and outs of classes, libraries, namespaces, etc to know where I'm going wrong. I've simply used the demo VB plugin project and replaced the functions with the VB equivalent of the display driver functions. The VB plugin examples have the functions inside the LCDSmartie class. Should it be the same for a display driver?
Rick, if you do find the VB driver source I'd appreciate a look at it! Was that in VB6 or one of the standard/pro .NET editions? I wonder if the Express edition of VB2005 is rather limited for creating drivers like this...
I've attached the current source/project files for reference. Any hints welcome! I'm kinda jumping in at the deep end here as far as VB programming goes...
You do not have the required permissions to view the files attached to this post.
-
- Posts: 36
- Joined: July 17th, 2007, 2:12 pm
- Contact:
What you are missing is that you need to externalize the DLL methods. Usually this is done in a .DEF file that you link to the project. How you do this in VB I am not clear on. But if you have a DLL explorer tool look at a driver that works and you will notice that the methods are public while the DLL you built in VB does not show any public methods.
Hope that helps,
Rick
http://lcdsmartie.fryar.org/
Hope that helps,
Rick
http://lcdsmartie.fryar.org/
-
- Forum Supporter
- Posts: 590
- Joined: March 8th, 2006, 1:58 pm
- Location: Scotland
I found a simple free DLL export viewer at www.nirsoft.net and it confirms what you said, Rick.
It looks like VB (at least the .net 200 express version I have) cannot produce ordinary DLLs with exported functions, only a class library (which works for Smartie plugins but not drivers). I came across a couple of postings on the web about workarounds to expose functions in a DLL, but it's basically a complicated hack to modify the compiled DLL. I can't see any way of linking with a DEF file, even if I created one manually.
I guess you aren't really supposed to do this sort of thing in VB, so I'll have a stab at it in C++ based on the SparkFun driver code. I compiled a skeleton driver in C++ and Smartie seems to think it's OK so I'm on the right track.
It's just a pity that I can't use VB to create the driver since I have all the necessary display commands coded in VB as a standalone demo app...
I'll post the driver once I get it working, on the off chance that somebody else has one of these LCDs.
It looks like VB (at least the .net 200 express version I have) cannot produce ordinary DLLs with exported functions, only a class library (which works for Smartie plugins but not drivers). I came across a couple of postings on the web about workarounds to expose functions in a DLL, but it's basically a complicated hack to modify the compiled DLL. I can't see any way of linking with a DEF file, even if I created one manually.
I guess you aren't really supposed to do this sort of thing in VB, so I'll have a stab at it in C++ based on the SparkFun driver code. I compiled a skeleton driver in C++ and Smartie seems to think it's OK so I'm on the right track.
It's just a pity that I can't use VB to create the driver since I have all the necessary display commands coded in VB as a standalone demo app...
I'll post the driver once I get it working, on the off chance that somebody else has one of these LCDs.
-
- Forum Supporter
- Posts: 590
- Joined: March 8th, 2006, 1:58 pm
- Location: Scotland
I've pretty much given up on getting the driver to work in VB - looks like there's no support for making ordinary driver type DLLs, only class libraries.
I've got the basics working in VC++ 2005 .net but it's not pretty. Took a bit of experimenting to get my head round the various type conversions (trying to use Ports::SerialPort so converting to/from System::String and char*).
There's a cobbled together mix of CLR/.net and old-style code and it doesn't seem to be very memory/cpu efficient, so I may yet get the Windows SDK and change to conventional win32 code, more like Rick and Enrico's drivers.
I used to have access to VC6, which I made a plugin with ages ago, but now I've only got VC++2005.NET Express to play with...
I've got the basics working in VC++ 2005 .net but it's not pretty. Took a bit of experimenting to get my head round the various type conversions (trying to use Ports::SerialPort so converting to/from System::String and char*).
There's a cobbled together mix of CLR/.net and old-style code and it doesn't seem to be very memory/cpu efficient, so I may yet get the Windows SDK and change to conventional win32 code, more like Rick and Enrico's drivers.
I used to have access to VC6, which I made a plugin with ages ago, but now I've only got VC++2005.NET Express to play with...