In the samples directory of Virtual Serial Port ActiveX Control you can find the demo application, which purpose is to show the functionality of the software. It allows to create ports, pairs, reset virtual serial bus, manage port access list, assign virtual serial port settings manually, manage signal lines states, check info about virtual serial ports, emulate full baudrate and connection line break.

Note: demo application may slightly differ in different programming language versions.

demo application

In “Port1” text box you can type the name of the virtual serial port, which will be created when you press “Create port” button. In case of successful port creation, “Create port” button will change its name to “Delete port”. When you press “Delete port” button, an attempt to delete virtual serial port will be performed.

Create pair” button creates virtual serial pair with the names you have typed in Port1 and Port2 text boxes. Note, that these 2 ports will be connected to each other via virtual null-modem cable.

Reset Bus” button removes all virtual serial pairs, currently existing in the system.

Send file” button allows selecting file to be sent through virtual serial pair. You can send it in chunks of bytes (amounts can be set in the corresponding text box).

In “Port access list” you can manage virtual port access rights (deny/grant) for selected programs which use virtual serial ports you create. This feature is made for those, who want to restrict access to created virtual serial ports for various applications. Priority for masks is ascending: when the first match is met, further masks are ignored.

Let’s review 3 different examples of masks usage:

  1. All applications are forbidden to use the virtual port, except for Windows HyperTerminal:Windows HyperTerminal

  2. All applications, which are located on local disc C only can use the virtual port:disc C

  3. In this case access will be granted to all applications, Windows HyperTerminal will not be forbidden.Windows HyperTerminal

Port settings” menu item allows you to assign virtual serial port settings manually, to see how many bytes were sent\received and to manage signal lines states by using the corresponding buttons: “Set CTS off”, “Set DSR off”, “Set DCD off” and “Set RING on”.

How can you assign virtual port settings manually? For example, your application opened virtual serial port with the following settings: 9600,N,8,1. But you want your application to operate virtual serial port with maximum connection speed, without any data loss.

The solution is the following: Change virtual serial port settings manually in VSP AX (in our case enable hardware flow control). Enter the following virtual serial port settings in “Port settings” text field: 9600,N,8,1,P and click “Set settings” button.

Let’s review assigned settings of virtual serial port: 9600,N,8,1,P

  • 9600 – means baudrate

  • N – parity

  • 8 – data bits

  • 1 – stop bits

  • P – hardware flow control

The parameters are the following:

Baudrate defines the rate at which bits are transmitted (bits per second). In the serial port context, “9600 baud” means that the serial port is capable of transferring a maximum of 9600 bits per second. To be able to communicate at the maximum speed, both local and remote ends must be configured to the same baud rate and pass handshake stage before you can successfully read or write data.

Databits defines the number of data bits to transmit. Usually, the transferred bits include the start bit, the data bits, the parity bit (if used), and the stop bits. However, only the data bits carry useful information. You can configure DataBits to 5, 6, 7, or 8. Data is transmitted as a series of five, six, seven, or eight bits with the least significant bit sent first (little-endian). At least seven data bits are required to transmit ASCII characters. Eight bits are required to transmit binary data. Five and six bit data formats are used for specialized communication equipment.

Parity defines the parity checking type. Parity can be one of the following: none, odd, even, mark, or space. If Parity is none, parity checking is not performed and the parity bit is not transmitted. If Parity is odd, the number of mark bits (1s) in the data is counted, and the parity bit is asserted or unasserted to obtain an odd number of mark bits. If Parity is even, the number of mark bits in the data is counted, and the parity bit is asserted or unasserted to obtain an even number of mark bits. If Parity is mark, the parity bit is asserted. If Parity is space, the parity bit is unasserted.

Stop bits sets the number of bits used to indicate end of a byte. Stop bits can be 1, 1.5, or 2, however almost all contemporary devices are configured to 1 Stop bit. Please, note that both ends of serial port must be configured to transmit the same number of stop bits to work properly.

Flow control defines the Flow control type. Flow control is usually used to ensure that the receiving serial port device can handle all of the incoming data sent to it. The following values can be assigned: Xon/Xoff (commonly used for asynchronous communication), Hardware and None.

Log data” text field provides detailed log of detected events, like virtual serial ports creation, opening, closing, data sending, etc.

“Terminal emulation” becomes active only when other application opens virtual serial port. Now, if other application sends something to virtual serial port, you see it in terminal window. If you type anything in this window, another application will receive it. Note, that virtual serial port terminal is very simple, and supports sending data only when you type it. So, when you copy and paste something to it, the data will not be sent.

You can see the exact path to the executable of the application that opens the port.

Emulate baudrate and Emulate line break checkboxes emulate full baudrate control and break connection line correspondingly. 

Note: In case you are using C Builder or Borland Delphi then prior to compiling the sample application you have to import ActiveX into your development environment. For more details, please, check Install tips.