reading and writing to a port using Visual Basic 
Author Message
 reading and writing to a port using Visual Basic

I am a high school teacher teaching microprocessors and am looking for a
development language which allows the reading and writing data to and from a
specified port address. An example is when I used Microsoft Quick Basic and
wanted to sent the letter 'A' to the hex address port 378H, the command looked
like: OUT &H378,&H41

And if I wanted to read the data from a device at port address 3F8H, the command
looked like:  data = INP(&H3F8)

How do I do this using Visual Basic. What is the sequence of commands that would
permit reading and writing data to a port address?

Thanking you in advance




Mon, 04 Aug 2003 08:27:06 GMT  
 reading and writing to a port using Visual Basic
Raw I/O port access in VB? That makes about as much sense as writing Windows
application in assembly.

In any event, this is the VB.Net newsgroup. I would suggest going to a VB
newsgroup, but I doubt you will have better luck.

--
Jonathan Allen


I am a high school teacher teaching microprocessors and am looking for a
development language which allows the reading and writing data to and from a
specified port address. An example is when I used Microsoft Quick Basic and
wanted to sent the letter 'A' to the hex address port 378H, the command
looked
like: OUT &H378,&H41

And if I wanted to read the data from a device at port address 3F8H, the
command
looked like:  data = INP(&H3F8)

How do I do this using Visual Basic. What is the sequence of commands that
would
permit reading and writing data to a port address?

Thanking you in advance




Mon, 04 Aug 2003 08:51:53 GMT  
 reading and writing to a port using Visual Basic
Hi Jonathan,

It does make sense. He wants the students to be able to use a RAD language
in an experimental capacity with microprocessors. The emphasis is probably
on the microprocesors, not writing device drivers for windows, in which case
VB is a good choice. There are a variety of dlls available for VB that give
this functionality. Unfortunately the free ones only work on win 9x, and for
winNt, 2K, he will probably have to but a device driver to allow him this
kind of port access. There's plenty of links on the web abotu doing this
kind of stuff, eg: www.lvr.com ,and dlls for IO on win95 are available from
there or from www.softciruits.com

So, Jonathan, whether you *think* it makes sense or not seems hardly
relevant. Others clearly do.  Thanks for the help though <g>


Quote:
> Raw I/O port access in VB? That makes about as much sense as writing
Windows
> application in assembly.

> In any event, this is the VB.Net newsgroup. I would suggest going to a VB
> newsgroup, but I doubt you will have better luck.

> --
> Jonathan Allen



> I am a high school teacher teaching microprocessors and am looking for a
> development language which allows the reading and writing data to and from
a
> specified port address. An example is when I used Microsoft Quick Basic
and
> wanted to sent the letter 'A' to the hex address port 378H, the command
> looked
> like: OUT &H378,&H41

> And if I wanted to read the data from a device at port address 3F8H, the
> command
> looked like:  data = INP(&H3F8)

> How do I do this using Visual Basic. What is the sequence of commands that
> would
> permit reading and writing data to a port address?

> Thanking you in advance





Mon, 04 Aug 2003 10:08:30 GMT  
 reading and writing to a port using Visual Basic
MS QuickBasic is closer to assembly language than VB.  If you're teaching
microprocessors, then I would expect that a little assembly language would
be a more appropriate level of language abstraction for this task than VB.
However, if you're teaching modern programming, then my only comment is that
writing directly to the LPT1 I/O port in VB generally isn't something that
should be done, or at least, until one knows the proper way to do this using
the Windows API or the MS Comm Control.


I am a high school teacher teaching microprocessors and am looking for a
development language which allows the reading and writing data to and from a
specified port address. An example is when I used Microsoft Quick Basic and
wanted to sent the letter 'A' to the hex address port 378H, the command
looked
like: OUT &H378,&H41

And if I wanted to read the data from a device at port address 3F8H, the
command
looked like:  data = INP(&H3F8)

How do I do this using Visual Basic. What is the sequence of commands that
would
permit reading and writing data to a port address?

Thanking you in advance




Mon, 04 Aug 2003 10:13:14 GMT  
 reading and writing to a port using Visual Basic
Hi Jonathan,

I do this all the time.  It is far from impractical (or ill-advised).

--
Richard Grier (Microsoft Visual Basic MVP)
Hard & Software
12962 West Louisiana Avenue
Lakewood, CO  80228
303-986-2179 (voice)
303-986-3143 (fax)
Author of Visual Basic Programmer's Guide to Serial Communications, 2nd
Edition ISBN 1-890422-25-8 (355 pages).
For information look on my homepage at http://www.hardandsoftware.net.
Use the Books link to order.  For faster service contact the publisher at
http://www.mabry.com/vbpgser.



Tue, 05 Aug 2003 01:01:33 GMT  
 reading and writing to a port using Visual Basic
Hi,

Here is my standard reply.  It still applies to VB.NET (as long as we are
talking about desktop applications).  BTW, you may want to take a look at
the PC Data Acquisition link on my homepage.

Depending on what OS and version of VB you are using...

You can download VBASM.ZIP (VB/16, Windows 3.1 or Windows 95/98), or
WIN95IO.ZIP (VB/32, Windows 95) from http://www.*-*-*.com/ .

Then, use the vbOut routine.  For example,

  vbOut &H378, MyData%

The complementary function is vbInp, to read I/O.

Similar functions are included in Stamina from MicroDexterity; again,
suitable for Windows 95, only.

I have an ActiveX OCX (look for IOOCX.OCX) on my homepage that you can
download that has some extra features that may be of interest.

If you need to do this under Windows NT, you can use a kernel-mode driver,
such as TINYPORT (go to http://www.*-*-*.com/ to download this shareware
driver).  Also, there are two commercial add-ons that provide I/O under both
Windows 95 and Windows NT.  You can get information (and order these at a
discount) from my homepage.  Just click on the VBxpert button and look at
DriverX OCX from Tetradyne or WinRT OCX from Blue Water Systems.  These
commercial products also allow read/write access to RAM, and support
hardware interrupts.  There is a similar object, called WinDriver from
KRFTech ( http://www.*-*-*.com/ ) that I am now starting to evaluate.
I have a link to it on my homepage, too.  This is quite a powerful toolset.

If you purchase DriverX and mention{*filter*} Grier/Hard & Software as the
referral when you order, you receive a 25% discount.

You can get detailed information on these things from the book, Parallel
Port Complete, by Jan Axelson.  Check this out on my homepage.  Just click
on the Books link.

--
Richard Grier (Microsoft Visual Basic MVP)
Hard & Software
12962 West Louisiana Avenue
Lakewood, CO  80228
303-986-2179 (voice)
303-986-3143 (fax)
Author of Visual Basic Programmer's Guide to Serial Communications, 2nd
Edition ISBN 1-890422-25-8 (355 pages).
For information look on my homepage at http://www.*-*-*.com/ .
Use the Books link to order.  For faster service contact the publisher at
http://www.*-*-*.com/



Tue, 05 Aug 2003 01:00:40 GMT  
 reading and writing to a port using Visual Basic
Hi{*filter*} --

Quote:
> I do this all the time.  It is far from impractical (or ill-advised).

Hey, I heard the MSComm control is byting the dust.  Will that affect you much?

Later...   Karl



Tue, 05 Aug 2003 03:57:20 GMT  
 reading and writing to a port using Visual Basic
Hi Karl,

Hey, I heard the MSComm control is byting the dust.  Will that affect you
much?
<<

Where did you hear that?  There is a new version of MSComm (that came with
VB.NET; at least I think it did).  Works fine in VB.NET, AFAIK.

--
Richard Grier (Microsoft Visual Basic MVP)
Hard & Software
12962 West Louisiana Avenue
Lakewood, CO  80228
303-986-2179 (voice)
303-986-3143 (fax)
Author of Visual Basic Programmer's Guide to Serial Communications, 2nd
Edition ISBN 1-890422-25-8 (355 pages).
For information look on my homepage at http://www.hardandsoftware.net.
Use the Books link to order.  For faster service contact the publisher at
http://www.mabry.com/vbpgser.



Tue, 05 Aug 2003 05:11:32 GMT  
 reading and writing to a port using Visual Basic
Hi{*filter*} --

Quote:

> Hey, I heard the MSComm control is byting the dust.  Will that affect you
> much?
> <<

> Where did you hear that?

Can't say.  Might be something you'd be interested in, though, if it were true.

Quote:
> There is a new version of MSComm (that came with
> VB.NET; at least I think it did).  Works fine in VB.NET, AFAIK.

Ah, well, that's good to hear.  

Thanks...   Karl



Tue, 05 Aug 2003 06:05:19 GMT  
 reading and writing to a port using Visual Basic
Wait a second. Are we talking about I/O Ports or COMM Ports?

--
Jonathan Allen



Quote:
> Hi{*filter*} --

> > I do this all the time.  It is far from impractical (or ill-advised).

> Hey, I heard the MSComm control is byting the dust.  Will that affect you
much?

> Later...   Karl



Tue, 05 Aug 2003 07:24:55 GMT  
 reading and writing to a port using Visual Basic
Hi Jonathan,

I was speaking of I/O ports (e.g., the printer port, etc.).  See my reply to
the original question.

--
Richard Grier (Microsoft Visual Basic MVP)
Hard & Software
12962 West Louisiana Avenue
Lakewood, CO  80228
303-986-2179 (voice)
303-986-3143 (fax)
Author of Visual Basic Programmer's Guide to Serial Communications, 2nd
Edition ISBN 1-890422-25-8 (355 pages).
For information look on my homepage at http://www.hardandsoftware.net.
Use the Books link to order.  For faster service contact the publisher at
http://www.mabry.com/vbpgser.



Wed, 06 Aug 2003 00:05:07 GMT  
 
 [ 11 post ] 

 Relevant Pages 

1. Reading/Writing from/to parallel port memory addresses with Visual Basic

2. Writing and reading to COM ports in Basic/QBasic

3. Using VB to read and write to Ports

4. Can I read the Serial Port from Visual Basic

5. Need to read and write Word Perfect 6.x files from Visual Basic

6. Communication with serial ports using Visual Basic...

7. flow control on com port using Visual Basic 6

8. Need to access printer port from Visual Basic using interrupts

9. Using Visual Basic for Excel 97 to communicate with Serial Port

10. how do I access the rs232 port using visual basic

11. Writing Reports using Data Reports in Visual Basic 6

12. Using Visual Basic to write to Paradox Tables

 

 
Powered by phpBB® Forum Software