| Visual Basic 5/6 Code Samples | ||||||||||||||||||||||||||||||||||||
| WinLIRC | ||||||||||||||||||||||||||||||||||||
| IO.dll | Parallel Monitor | |||||||||||||||||||||||||||||||||||
| This all started when my brother decided to threw out a brand new, OEM packaged, Packard Bell fast media IR remote. Being a tinkerer, I thought it would be fun to try to write a few aps for the remote. I got the remote from my brother and went to work. I quickly realized that this was not going to be a five minute deal. The code samples below represent solutions to the problems I encountered during development of my programs. The .zip files contain source code, an .exe created from the source code, and in some cases sample schematics. I have tried to give credit were credit is due but most of this stuff was compiled during frantic searches on the internet for code snippets and I have forgotten were I got some of it. Please, send me an E-mail if you see anything that looks familiar and let me know who wrote it. If the information here can help out just one person suffering through a project than it will all have been worth it. Onani. |
||||||||||||||||||||||||||||||||||||
| WinLIRC | ||||||||||||||||||||||||||||||||||||
| So, I have the Packard Bell IR remote connected to my serial port, how do I get the data from the remote into a useful form ? WinLIRC that's how ! This easy to use program is free and the website has a great deal of information concerning it's use. |
||||||||||||||||||||||||||||||||||||
| Connecting to the WinLIRC server | ||||||||||||||||||||||||||||||||||||
| Now that I have the remote data available to me through the WinLIRC server how do I connect to the server to retrieve the data ? The developers page of the WinLIRC website has this covered. I borrowed some of the Visual Basic code provided by Martin Kubik and created two sample programs to allow you to connect to the WinLIRC server. The first sample uses the Visual Basic Winsock 6.0 control to connect to the server and the second sample uses the Winsock 6.0 control and Assaf Rozenblatt's ActiveX control Infrared.ocx I have not commented the source code of these samples yet. I will add them as soon as I have time. |
||||||||||||||||||||||||||||||||||||
| Software remote control | ||||||||||||||||||||||||||||||||||||
| Call me lazy but I got tired of picking up the remote control to test various parts of my programs so I created a software version of the remote control to replace the actual remote and WinLIRC. This program simulates the look and functionality of the Packard Bell fast media remote and the WinLIRC server. |
||||||||||||||||||||||||||||||||||||
| Sending parallel data through parallel port with IO.dll | ||||||||||||||||||||||||||||||||||||
| Now that I have the "I" part down I need to tackle the "O" part. I want to control some hardware attached to the parallel port with my programs. Unfortunately, unlike C, Visual Basic does not have a native ability to control the parallel port. So how do I do it ? IO.dll to the rescue ! This dll written by Fred Bulback works with Windows 9x and Windows 2000/XP. Fred's website has all the information needed to use the dll but as a novice VB programmer I wasn't sure how to use it until I found this excellent tutorial created by Jim Fuller. I am sorry to say that Jim is no longer with us, but his work lives on. When running these programs you could use a HP mixed signal DSO to verify that the parallel port is doing what you want it to like I did, or, you could download Fred Bulback's Parallel Port Monitor and do about the same job for free. The sample program let's you enter the data to send and select the data or control port of the parallel port to send it to. The simplified schematic shows connections to the parallel port and buffering needed to prevent damage to the parallel port when driving external devices. |
||||||||||||||||||||||||||||||||||||
| Sending serial data through parallel port with IO.dll | ||||||||||||||||||||||||||||||||||||
| This sample program let's you select one of six devices to control and sends simulated three wire serial through the parallel port to this device. The simplified schematic shows connections to the parallel port, buffering, and chip select signal inversion required to control six SPI devices with the sample program. The signal timing diagram shows the serial pulse transition timing generated by the sample program. Testing shows the pulse width to be stable and accurate down to about 25 uSec's. |
||||||||||||||||||||||||||||||||||||
| Character LCD control with the parallel port | ||||||||||||||||||||||||||||||||||||
| Now that you can control the parallel port it's time to make it do something. The sample program is written to control a HD44780 based LCD module. It may need modification if you are using a LCD module with another type of controller. More HD44780 information is available here. The schematic shows the wiring for a direct connection to the parallel port. This should work on all systems but since the parallel port provides power for the LCD module the contrast may be minimal. The LCD module pinouts shown on the schematic are for a 2x16, non-backlit, LCD module I scrounged up. The signal names shown should be the same for all LCD modules but the pin numbers may be different. Please refer to the datasheet for the LCD module you plan to use. |
||||||||||||||||||||||||||||||||||||
| Control GPIB device with the parallel port | ||||||||||||||||||||||||||||||||||||
| This sample program let's you send GPIB commands to a GPIB device connected to your parallel port. The GPIB commands and the address of the GPIB device are contained in a text configuration file. Selecting a configuration file sets the GPIB address and populates command buttons with a functional description and the actual GPIB commands to send to the GPIB device. The included sample configuration file demonstrates the format used to configure the GPIB device address and the command buttons. Line 1 - GPIB device address. Line 2 - Command button description. Line 3 - GPIB command to send to the GPIB device. Repeat the description and command line pairs (Lines 2 and 3) for as many GPIB commands as required. (22 command buttons total.) The simplified schematic shows the parallel port to GPIB device connections required. The zip file includes a PCB123 layout file and BOM for a parallel port to GPIB device adapter board. |
||||||||||||||||||||||||||||||||||||
| Home | ||||||||||||||||||||||||||||||||||||
| IRDA | ||||||||||||||||||||||||||||||||||||