none
Communication to LPT1 and Com ports

    Question

  • I'm relativly new to visual Studio .net and have not had a lot of expereince with programming applications to read and send data to Com ports or LPT1 ports. I am contemplating rewritting an application currently written in Access to track data that comes from a scale. The LTP port receives prompts from the scale signifying that there is data that is going to be transfered. That in turn opens Com port 1 and the scale sends a string to the PC, the PC evaluates the string and pulls out the data location that contains the weight and the operator and then returns the subtracted weight out Com port 3 to the scale to be posted on the display.

     

    How would I open the Com ports and establish this communication to send and recieve the data, and also act in a listening fashion on the LPT1 port? Is there a SDK or system namespace that could be used to do this kind of communication?

    Friday, August 18, 2006 8:36 PM

Answers

  • You can download a parallel I/O driver from here.  Add these P/Invoke declarations to use it:

      Public Declare Function DlPortReadPortUchar Lib "dlportio.dll" (ByVal Port As Integer) As Byte
      Public Declare Sub DlPortWritePortUchar Lib "dlportio.dll" (ByVal Port As Integer, ByVal Value As Byte)

    Use the .NET 2.0 System.IO.Ports.SerialPort class to talk to the Com port.

    Saturday, August 19, 2006 9:47 AM

All replies