| Win95io 1.01 |
| By: SoftCircuits Programming Date: 31/07/1997 |
| File: | win95io.zip |
Size: | 3 KB |
You can read/write any port by specifying its I/O
address and a byte number (0-255).
To use the DLL you first need to add the following declarations to a module.
| Declare Sub vbOut Lib "WIN95IO.DLL" (ByVal
nPort As Integer, ByVal nData As Integer) Declare Sub vbOutw Lib "WIN95IO.DLL" (ByVal nPort As Integer, ByVal nData As Integer) Declare Function vbInp Lib "WIN95IO.DLL" (ByVal nPort As Integer) As Integer Declare Function vbInpw Lib "WIN95IO.DLL" (ByVal nPort As Integer) As Integer |
Example 1
| Port | Hex. | Dec. |
| LPT1 | &H378 | 888 |
| LPT2 | &H3BC | 956 |
| COM1 | &H3F8 | 1016 |
| COM2 | &H2F8 | 760 |
| COM3 | &H3E8 | 1000 |
| COM4 | &H2E8 | 744 |
The following code sends the character "A" to the LPT1 port.
| vbOut &H378, 65 |
The port address &H378 (hexadecimal) may have been replaced by the decimal 888.
The byte number 65
("A") may have been replaced by the value returned by the Asc function: Asc("A").
| vbOut 888, Asc("A") |
Example 2
The following example reads a character from COM1.
| Dim Data As Byte Data = vbInp(&H3F8) |
Again, you may replace &H3F8 with 1016.
The value read from the port is stored in the Data variable, and you can convert it to text with Chr(Data).
To install, extract the win95io.dll file from the ZIP archive to C:\Windows\System. Remember that you must distribuite the DLL with exery project that uses it and install it in C:\Windows\System or in the program's folder.
| Visual Basic Programming Zone is a website by
Lorenzo Dalla Vecchia. To contact the Webmaster, click here. Hosted by InWind: www.inwind.it |