Results 1 to 16 of 16

Thread: VB6 - How to program device drivers

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2012
    Posts
    290

    VB6 - How to program device drivers

    I've never read or heard anything about programming drivers. My neighbor and I are building like a radio-modem that will help to get access to internet. This is like wifi technology and we're doing this because we want to learn more things about programming and building circuits.

    My question is if someone has some experience or information about if it's possible to program a driver for that device in VB6 and what would be necessary (in general). All advices are welcome.
    Last edited by Jose_VB; Dec 6th, 2012 at 12:19 PM.

  2. #2
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: VB6 - Programming drivers

    I think drivers are written in Assembly. I know there are books on how to write drivers as I have two but I can't tell you how or where to get them. There's a WebSite that is dedicated to Assembly that you might want to join as they may have code and/or info on drivers. Look for masm.com or something like that.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2012
    Posts
    290

    Re: VB6 - How to program device drivers

    I've also found in the net that it exist a platform called Windows Driver Kit. In its last version, number 8, it's integrated with the last version of visual studio and it's not compatible with Xp. The before version, is compatible with Xp but I don't know if it's integrated with some version of visual studio.

  4. #4
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: VB6 - How to program device drivers

    I don't know either but to write a driver (Assembly I believe but I guess C/C++ could also be used) you don't need it integrated with any version of Windows as drivers deal more with the computer and hardware rather than the OS.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2012
    Posts
    290

    Re: VB6 - How to program device drivers

    I know that when you want to program the driver into the hardware's chip, you need to use assembly.
    But in windows...? Usually the driver is a file like "Driver.DLL". I know anyone can program DLL files in vb.

  6. #6
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: VB6 - How to program device drivers

    Yes, you can write DLLs in VB however drivers access the hardware and the computer and that you can't do (at least I don't think you can) in VB. I'm not even sure you can access hardware using C/C++ but I don't know.

    It's possible to write a VB app which calls a DLL but then the DLL is probably written in Assembly if it is a driver.

    When I get the time I will look for my two books on writing drivers and post their titles etc. Maybe you can find them on the Net (Ebay for example).


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  7. #7
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: VB6 - How to program device drivers

    VB6 can not be used to write device drivers. Typically this is done in C++.
    There is info on MSDN related to driver creation but it is not a simple thing to do and requires an understanding of the hardware and windows core.

  8. #8
    Cumbrian Milk's Avatar
    Join Date
    Jan 2007
    Location
    0xDEADBEEF
    Posts
    2,448

    Re: VB6 - How to program device drivers

    If you want to learn more you could perhaps have a look at building an open source project such as the windows port of libusb. The project is written in C.
    W o t . S i g

  9. #9
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: VB6 - How to program device drivers

    Actually most drivers are quite OS-specific since they serve as a bridge between very low-level facilities and those of the OS. Tons of XP drivers don't work on post-XP systems, etc.

    But if you dig very deep into the DDK (now WDK), you can find info on API calls for device control that may let you work with a device with no formal driver at all.

    For example recently I wrote some VB6 programs to work with a specialized device that appears as a vendor-specific USB HID device. The guys working in Linux needed libusb but Windows handles HID devices generically enough that by using some low-level calls no specific driver needed to be created at all.

    So it becomes a question of what kind of bus your "radio modem" connects to (USB? PCI? ISA?), which glue chip you choose, what low-level device type it presents itself as to Windows, and what level of support Windows already offers for this type of device.

    Remember, "drivers" are a layered topic. A printer driver can work on top of a serial port driver, etc.

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2012
    Posts
    290

    Re: VB6 - How to program device drivers

    @dilettante
    At the moment, because this is the first phase, we've thought to use serial port to connect the external hardware to the computer. I cannot enter in more details because I don't know how the device will be. We're just learning and maybe we select an option that today we don't know. In vb6 I think you can manage the serial port using an ActiveX control. I'll try to read some documentation to get a more clear idea.

  11. #11
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: VB6 - How to program device drivers

    Serial ports can be a solution though they offer relatively low data rates. VB6 Pro and Enterprise include the MSComm control for working with them.

    But if you really want to create a device supporting generalized networking such as IP connections VB6 is not going to be of much help. If the low data rates of a serial port work for you then Windows already has networking support built in which can work with it.

    At most you just need to work like a standard modem and either provide a custom modem .inf file, or make your device use modem commands that match one of the stadnard modem profiles supplied in Windows.

    See Function of Modem INF Files which may work as a starting point.

  12. #12

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2012
    Posts
    290

    Re: VB6 - How to program device drivers

    I'm checking the information. But it can be a very good idea. I didn't know about that solution but you say that I can treat my FM transmitter like a standard modem. So I will check the documentation and I will read it carefully.
    The speed of the connection is not very important at the moment. It will be fine if I can transfer data at 10 kpbs.

  13. #13
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: VB6 - How to program device drivers

    Everything depends on how your device appears to Windows, at a level above the connection type itself (such as an RS-232, etc. serial device).

    The modems that Windows can work with using just a simple .INF file to describe them are "smart" devices. They have a limited ability to accept commands and return information using variations and extensions of the old "AT" command set pioneered back in the late 1970s.

    So this presumes that your device will have some sort of a microcontroller between the serial port the PC sees and the radio itself. Even something like an Arduino should be more than enough processing power, and there may be single-chip microcontrollers out there designed for this very task.

    I see that searches turn up lots of projects of this sort, example:

    http://www.qsl.net/ct1efl/rs232_interface.htm

  14. #14

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2012
    Posts
    290

    Re: VB6 - How to program device drivers

    @dilettante
    Reading the internet I thought about Arduino. I didn't know anything about it but I see a lot of people make projects in very short period of time and it's not too difficult to understand.

    I'm reading all the links you're posting because I think I've started with an idea and I've to document myself a lot because I don't have any experience on that and we've to build the device, program a software, etc... that is a huge work is I don't know almost anything.
    Thanks for the links again.

  15. #15
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: VB6 - How to program device drivers

    I built a project involving Radio a few years back. It had a UHF Receiver and some UHF Transmitters. The purpose was to create a sort of 'Alarm System'. The holders of the Transmitters (they were installed into Key Fobs) could press a Button and the Receiver detected the Key's number and which Button was pressed (there were 3 buttons) it then sent the data via RS232 to the 'Server'. The range was about 400M.

    Connected to the 'Server' via the Internet were Clients who were informed who pressed which button and when. Also connected to the PC was an old Mobile 'phone and when the 'Alarm' was triggered the 'Server' sent SMS messages to designated numbers as well.

    The circuitry was very simple, the UHF receiver was self contained on its own board and the only other discrete componenets were a MAX232 IC and a few Capacitors to convert the voltage levels from the Receiver to RS232 levels. I didn't need any 'low-level' code I just used the standard MSComm Control and VB6 for the 'Server'.

    It was designed for my Father-in-law who is getting old and lives alone - we were worried about him having a fall at home and being unable to summon help - he could carry the Key fob around with him. The SMS messages would have been sent to his Neighbours who could have gone round to assist quickly. The system also had the ability for a receiver of an SMS message to send a reply to indicate that they were responding - if such a response hadn't been received by the 'Server' after 10 minutes then I / my wife would have called the Emergency Services.

    Fortunately it was never 'used in anger' but was an interesting and inexpensive, little Project. I think it came to about 15UKP which is very cheap for the peace of mind it gave us.

  16. #16
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: VB6 - How to program device drivers

    My neighbor and I are building like a radio-modem that will help to get access to internet.
    This is a bit more sophisticated than reading a few twiddled control lines. One end will have to run RRAS (see Get IT Done: Configure Windows XP Pro as a remote access server) or they'll need a router supporting PPP or similar on inbound modem connectons. The client part is easier since the Dialup Networking client is part of Windows in modern versions or available to be installed as far back as Win95 (and actually back to Win3.x).

    These services require a modem to... look like a modem, or else at least a full RS-232 port supporting the necessary control-line based connection establishment.

    On WinXP Pro there is support in RRAS for the old "direct cable connect" based on a parallel port, but that's pretty much gone in later Windows versions.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width