Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How can we make communication with RS-232 port's data on visual basic?

Hello

 

I am going to test my serial device with programmed in visual basic software.

I am learnig it, so please help me to do programing.

"SB02"
0 Kudos
Message 1 of 4
(3,750 Views)

@Bhadresh wrote:

Hello

 

I am going to test my serial device with programmed in visual basic software.

I am learnig it, so please help me to do programing.


Visual Basic 6 or Visual Basic.NET

makes a difference

 

either way, Google is your friend

 

 

0 Kudos
Message 2 of 4
(3,738 Views)

Hi,

 

I think your best bet is to use use a serial session in NI-Visa and .NET. I've used Microsoft's Serial class before with instrumentation and have had some problems.

 

Imports NationalInstruments.VisaNS 'set a reference to visa first


Public Class Form1

    Dim meter As VisaNS.SerialSession

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


        Try


            meter = New SerialSession("ASRL1::INSTR") 'comport 1
            meter.BaudRate = 9600
            meter.DataBits = 8
            meter.StopBits = StopBitType.Two
            meter.Parity = Parity.None
            meter.FlowControl = FlowControlTypes.DtrDsr
            meter.Timeout = 5000


            meter.Write("CONF:VOLT:DC")
            meter.Write("VOLT:DC:RANG:AUTO ON")

            meter.Write(":READ?")

            TextBox1.Text = meter.ReadString()


        Catch ex As Exception

        End Try

    End Sub

End Class

 

Curt

0 Kudos
Message 3 of 4
(3,724 Views)

Keep in mind that there are fees for NI-VISA if you are not using any NI hardware or software.

0 Kudos
Message 4 of 4
(3,719 Views)