473,770 Members | 7,213 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Controlling RS232 and LPT Port using VB .NET

Dear Readers,

I was reading about how to control the COM and LPT port using VB .NET.
I've found a lot of information, and it was very useful to me. I found
an example program on the site of Microsoft. You can find it overhere:
http://www.microsoft.com/downloads/d...DisplayLang=en

I did found a lot about the RS232 port on the Internet, but i haven't
found the same amount of information about controlling the LPT Port
using VB .NET.

I have two questions:

1. How can i change the power voltage on a pin in the COM Port? I wan't
to change it to 5Volt using VB .NET, but i haven't found anything about
this on the Internet.

2. How can i ''read'' a PIN from the LPT port. So if i set its value to
8Volt, is it possible to make a program that gives the value of the
power voltage on the pin?

It are my two main questions. I've found programs to control your
printer and modem in VB .NET, but i just can't find anything about this
subject on the internet. So you guys are my last hope:-)

Thanks in advance,

Wouter van Teijlingen
The Netherlands
Nov 21 '05 #1
2 5159
Hi,

You might be interested in my book (see below). It covers .NET. I also
have controls that can be downloaded from my homepage. You will find the
IONet control for Visual Studio .NET 2003 useful for parallel IO.

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
www.mabry.com/vbpgser4 to order.
Nov 21 '05 #2
Also, you asked:
1. How can i change the power voltage on a pin in the COM Port? I wan't
to change it to 5Volt using VB .NET, but i haven't found anything about
this on the Internet.
<<<<<

You cannot. The voltage is fixed by the supply voltage to the RS-232
driver. You can limit the excursion to 5V using some add-on hardware, but
you cannot control this directly using software.

2. How can i ''read'' a PIN from the LPT port. So if i set its value to
8Volt, is it possible to make a program that gives the value of the
power voltage on the pin?
<<

The input voltage to the parallel port SHOULD NOT exceed 5V. If it does,
you may damage the port. The IONet control that I mentioned in my other
message provides both Input and Output method. Individual pins are mapped
to bits in one of the I/O registers at the printer port address.

However... These are digital IO pins. You cannot measure voltage. They
either are on (+5v) or off (0v). If you want to measure voltage, you need
an analog to digital converter. I suggest that you look at the PC Data
Acquisition link on my homepage. I show devices that do this -- some
connect to the serial port, others to the parallel port -- none are supplied
with a conventional computer. You have to add them.

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
www.mabry.com/vbpgser4 to order.
Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
12755
by: Chris | last post by:
Here's the situation: I work at a scientific institution and I have a portable electronic device which is used to take measurements. The device produces a very small amount of numerical data, about 10 to 15 numbers per measurement. This operation is performed frequently and I would like to implement an automatic solution that moves this data across a windows network and into the fields of an Access database application. The device...
1
7821
by: Dan | last post by:
I wnat to see in browser an status from an device connected on rs232 port The java class for read from serial port is: //Serial.java import java.io.*; import java.util.*; import java.lang.*; import javax.comm.*;
0
2199
by: Jason T | last post by:
I've downloaded and installed the '101 Visual Basic and C# Code Samples' from http://www.microsoft.com/downloads/details.aspx?familyid=08e3d5f8-033d-420b-a3b1-3074505c03f3&displaylang=en I have used the 'Framework - Using the COM Port' sample, from a windows forms application, and it works perfectly. I have also use the 'Framework - How-To MSMQ' sample with no problems at all.
6
9136
by: Ken Breit | last post by:
I am using the RS232.vb class to talk to the serial port. The problem I am having is when I try to read if anything is on the comm port. I call the read method, with the number of bytes I am expecting to read. As long as I know the length of the command that I will be getting on the input of the port it works great. The problem is when I don't know how long the data I am receiving is. If I request more bytes than I know I am getting...
8
2063
by: Terry Olsen | last post by:
I'm trying to use the RS232 class that was in the Platform SDK (i think). Has anyone else used this with events successfully? Here's what i've got: ====================== Public WithEvents bbsPort As Rs232 = New Rs232 With bbsPort .BaudRate = baud .DataBit = dataBits .Parity = parity .Port = comPort
2
1451
by: Mika M | last post by:
Hi! My application uses Rs232-class, which was shipped with "101 VB.NET Samples\Framework - Using the COM Port". I need to sent certain kind of string into peripheral equipment attached to COM1-port , and after receiving this string of my application this equipment should return string back into my application. Is it possible by using this Rs232-class to get return string after sending string into COM-port first? I haven't succeeded...
13
6866
by: jay.dow | last post by:
I want to write to the pins of an RS232 without using the serial protocol. The use would be every pin could act to complete a circuit in customized hardware. I could use python to communicate serially to a BASIC stamp or a Javelin stamp and then use the stamp to set however many pins as 0's or 1's but should it be that hard to do with python. I've looked through how python does serial with the "serial" module but it just uses Java's...
4
5503
by: Dave Harry | last post by:
I found the RS232 class from MS's 101 VB samples. Writing to the port works fine. (I've got hyperterminal on the other comm port and a crossover cable between COM1 and COM2) The port is opened with: Public switchcom As New Rs232 switchcom.Open(2, 57600, 8, Rs232.DataParity.Parity_None, Rs232.DataStopBit.StopBit_1, 512)
5
3035
by: =?Utf-8?B?Q2hyaXN0aWFuIEhhdmVs?= | last post by:
Hi, how can I access the RS-232 hardware interface using C# and .NET2.0 to send and receive messages to a hardware component? Christian
0
9592
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10230
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9870
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7416
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6678
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5450
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2817
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.