Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




VB.Net And RS232 Communication ??


Hi everyone !

In the past I've done several projects under VB6 to talk to measurements devices hooked to the RS232 ports of the computer. I used the MSComm-Control for this.

Now I'm making the transition the VB.NET, and I don't see how I should do this RS232 communication, as the MSComm isn't shipped with VB.Net...

Has anyone some information, pointers or hints as how I may implement serial communication under VB.Net ??

TIA

Phil




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Rs232 Communication
hi everyone
i am trying to get data from a device using rs232 port.
until now i have written the following


Private Sub cmdGetData_Click()
txtDisplay.Text = MSComm1.Input
End Sub

Private Sub Form_Load()
'Dim Instring As String
' Use COM1.
MSComm1.CommPort = 1
' 9600 baud, no parity, 8 data, and 1 stop bit.
MSComm1.Settings = "9600,N,8,1"
' Tell the control to read entire buffer when Input
' is used.
MSComm1.InputLen = 0
' Open the port.
MSComm1.PortOpen = True

End Sub



i was expecting to get data continously in the textbox from the device. but it shows only once. and then nothing. do i have to put in some loop?
kindly advice how do i proceed in order to get data continously from the device. also please tell me how to save the data once i get them.
any help will be greatly appreciated.
thanks in advance.

RS232 Communication
Hi, I want to create an application that reads from a RS232 port (COM) and print the data received on the screen. I have an RF module connected to the RS232 so the data is an analog waveform.
I want to be able to read and transmit data through the COM port. I do not have much experience with comm. ports.
Any help or source where I can look into is appreciated.
I'm working on a Robotics project.

Thanks,
Diego.-

Using VB6 (SP3)

RS232 Communication With I2c Protocol
HI

Does anyone have some expeciance with programming an i2c interface on the serial port on a windows xp system.
I'm want to make a sort of thermometer.
I've made a interface that uses the RTS/CTS lines from the rs232 for making the SCL signal and the CD/DTR lines from the rs232 for the SDA line.

The SCL line is the clock line and should have frequency of 100kHz, this line must be generated by the rs232.

The SDA line is an input and a output.
First it should generate the 8 address bits: 10010001
Where the first 4 bits are the fix, the 3 next bits the address of LM75 and the last should be 1, so the LM74 knows that we want te read information.

The the LM 75 sends 9 bits to the rs 232 contaning the information about the temperature.

Is there anyone that knows how to start with this topic.
I tried with MSComm but .... like I'm a newbie it is not very clear for me.
I even don't know how to generate the SCL (clock signal) line of 100 kHz on the RTS/CTS line

I attached the diagrams containing more information.

Thx

Mscomm Communication Via RS232
hi
i was wondering if anyone can tell me how to send a file from my computers com port to another computers com port via RS232 with a stright 9 pin cable thanks...

RS232 Communication Software
I wont to make a program that will send and recive data from PC <-->NC machine.Files will have *.nc extension.
How to write code that recived data will be transfered into textbox and then i could save it as *nc file?
secont: open *.nc file with data ( nc code) and send it to maschine?

I will use MS Visual Basic for MS DOS for this.

MSComm RS232 Communication
As a new user to Visual Basic, I am trying to use MSComm to communicate serially with a datlogger which i am trying to poll every second for data. I am getting VB 6.0 Pro tomorrow and should have no problems with the control itself as i do now with VB 5.0 However, do need help with setting the time intervals for polling the logger using MSComm and also if i can open both port on the same form if i wish to communicate with another piece of serailly linked equipment. Anyone?

Serial Communication With RS232
I was wondering if anyone had any code or any suggestions on how I could obtain some inforfation on how to write a program that would communicate through an RS232 communications port. I have this project in front of me and I need to communicate to some radios off site. I need that data from the radios to be sent back to the pc via RS232.

RS232 Communication For Data Acquisition
I need to send and riceive string from an instrument by com1 interface and excell 2000, iI have written this lines:

Dim var As String
var = "*cls"
Open "com1: 1200,n,8,2,rs,cd,lf,pe" For Random As #1
Put #1, , var
Close

but the instrument gives me the following error:
RS232 framing error

can someone help me?

RS232 Communication... On A Bitwise Level
Alright, a real challenge for VB

I know very little about using RS232 communication for anything other than just straight Rx Tx kinda communication....

I think that it has to have at least 4 output bits

is this right?

if so I need to manipulate the values of those.

I would need to send a sequence of...

1000
0100
0010
0001

Don't try to make sense of this, it is just to talk to hardware, and this is the sequence it needs to work. So this is basically what I need to do, I have a c++ program to do this through the parrell port, but it is very very slow, and I was wanting to take advantage of the higher baud rates that the RS232 hardware allows.

Nick

RS232 Serial Communication Question
I'm building a tool to simulate a portion of an embedded system. I need to be able to use the RTS and CTS lines on the PC's serial port for out of band signaling. Example: I'm physically connected to a device via a standard 9 wire serial cable. When I want to let the device know that I'm ready to send data, I need to set the RTS line high. In response, the device will set the CTS line high. This lets me know that the device is prepared to receive and send data over the normal receive and send lines. Is this even possible using the MSCOMM control and VB? If not VB, can I do this is C?

Any help is greatly appreciated.

Vb Controller Code For Usb Port Convert To Rs232 Communication
Hi friends!
For rs232 communication we use MScom control as controller,so what kind of controller for usb port? i`m using bafo usb to serial converter and install the driver, i check it in device manager under port(com&lpt) indicate as Prolific USB-to-Serial Bridge (Com3).

Rs232
i recently posted a thread on the forum and i am just adding some more details

i have a security camera and i am in need of communicating with it through my com port2 (rs232 system)

the camera address is 01


i am running this with visual basic and have come up empty at the momemt

i have also downloaded the in..32.dll file from the internet and the source code but still dont understand

please help

thank you

Robert

RS232... Need Help
hay guys

i'm quite new to vb6. I'm trying to send the data via RS232. I used MScom. I send out 1 Byte at at time. I can see the correct data on oscilloscope. But the problem is that between each byte is about 3ms of delay occuring.. the stop bit stay high for about 3ms and another data byte is send out.. But the strange thing is that all data byte looks correct... my question is that, on my laptop i'm using USB to RS232 converter.. Is it causing the problem.. no RS232 on my notebook ( ) .. ok currently no desktop PC available... pls i'm really mad...very urgent to go further.. Thx..

phone naing

Rs232
hello, i wanted to know how can i send information using VisualBasic thru a COM port (rs232), and also, how can i control some applications (like WinAmp), using VisualBasic, by reading data from a COM port?

Rs232
hi all, im a newbie and have got the coding below to read information in from a PIC Microcontroller.. Could anyone suggest how to change this code to send information the opposite way- out to a microcontroller???

All help greatly appreciated.
Thank you
Stephen
VB Code:
Private Sub CmdScan_Click()Dim startedOn Error GoTo Errorhandlerstarted = False   DoEvents   Timer1.Enabled = True   Instring$ = ""   TxtInput.Text = ""   Done = False   If MSComm1.PortOpen = False Then      MSComm1.PortOpen = True   End If   lblaction.Caption = "WAITING FOR SCAN"   Instring$ = ""   Do While Not Done      DoEvents      Do While MSComm1.InBufferCount > 0         started = True         DoEvents         Instring$ = Instring$ & MSComm1.Input         Timer2.Interval = 100         Timer2.Enabled = True         Do While Timer2.Enabled = True         DoEvents         Loop      Loop      If MSComm1.InBufferCount = 0 And started = True Then         Done = True      End If   Loop   TxtInput.Text = Instring$   Timer1.Enabled = False   If MSComm1.PortOpen = True Then      MSComm1.PortOpen = False   End If   lblaction = Len(Instring$)Exit Sub

Rs232 Help
Hey Guys,

I was wondering does anyone know how to develop a form to read a value I am picking up via rs232?

I have using a PIC 16f877 Micro and a ds1620 temperature sensor - at the minute I am sending the temperature via rs232 just to hyperterminal - i want to hopefully develop a Visual Basic form to take the rs232 value and display it, etc. Any help would be greatly appreciated.

RS232 Please Help
Hi!

I connect my mobile phone to my pc via a cable. I open the Hyper Terminal and I write:

AT+CMGW (enter)
> text
Control+Z

Now I want to do this with a VB program like this :





When I push the button “setup port 1” the program must to send the command “AT+CMGW” to the phone. The second window opens (picture2) end firtly I must write the text. When I push th button (ok) the program must to send the text and the command (control+Z) to the mobile phone.

Can anyone help me with the code please?
Thank you very much.

Rs232
Hi All,

I am new to evb. I have downloaded embeded visual basic 3 and had a play with it. It seems to be quite similar to std vb. I have some questuions.

1. Will i be able to make an aplication for ce 2003? It seems to only ask me if I want to create one for ce2002 when I make a new project.

2. When I go to add a component, there is no ms comm addin. Is there an easy way I can talk to the com port. I want to receive and send data to it.

Thanks,
Ben    

Rs232 - TXd Pin
I have to reset (space = 0) the TXD pin of serial Port Rs232 fo 2 second. I can't do it with the MsCom object. I think there is a low level way to do it , like C with the inport instruction. Do you know the inport (input to the port I/O xxx) instructio for VB?


Thanks for Help.

Problem With RS232 N VB
Hi,
i am now facing some problem in sending data n receiving data by using serial port. i connect my com port 1 to a MAX232. i had short circuit pin11(T1In) and pin12(R1Out). thats mean i will receive the same data that i sent. i did this circuit to test on my vb program wheater it can send and receive data to / from an external circuit.

i tried an software named CommSniffer and i can receive the data i sent, thats mean my circuit is ok. but i failed when i try it with VB6. i have trying and modifying on many samples in this forum but none of them work for me.

1 of my reference is the sample from this thread:
http://www.xtremevbtalk.com/showthread.php?t=153229

can any1 please hep me on this???

thanks

gie

RS232 Timing
I am having some timing issues with a data stream via RS232. From this propritary signal, I get two data lengths 856 bytes and 546 bytes. and the data feed is continious. Both have a <SOH> = &H01 and <EOT> = &H04. My problem is on starting my VB, is i randomly can jump in the middle of all this. There are no control lines to signal a starting point. How do I get around this continious feed and capture the data stream on the <SOH>

Thank you for any support!!

Mp3 Files Through Rs232
does any one hex format of mp3 file
i think it is stubid quasition but i'm try to store this files through serial to
pic then into flash memory so i need to know how to start to transmit the file
please heeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeelp

Rs232 Interface
hi,

how to start rs232 communication? im totally dont know how and where to get sample code for vb6, on initializing and detecting rs232 device. pls sumone help me~

b4, ive been working on usb communication using vb with the help of jan axelson's sample code. it works well.. n now i want to learn about rs232 n really need a sample code.

RS232 Network
Hey, I got a serial cable connecting from one of my PC to another. I am looking for VB code or existing program that allows me to transfer files between the two PCs.

Thx.

Newby On RS232 Again
Hello,

What do I do wrong?
I would like to "synchronize" the incoming message somehow. I mean I don't want to see any truncated "Hello world!" messages but it does happen sometimes. I tried this:

Private Sub MSComm1_OnComm()
If Flag = 0 Then
Do Until MSComm1.Input = "H"
Flag = 1
Loop
End If
Temp = Temp & MSComm1.Input
Text1.Text = Text1.Text & Temp
End Sub

The goal would be to use Flag to indicate synchronization. Flag would be set to 0 in form_load() so in the first time the If/then block should be fired. In this block the loop would wait until the incoming character is "H", the first of the "Hello world!", then set the Flag (now it is "in sync"), then leave the if/then block and capture all incoming message.
The flag would be zeroed after clicking on "Close port", because next time the port is opened chances are there'd be no synchronization :-)

Needless to say the above rutine does not work :-) What's wrong?

Gurus out there?

Levente

Rs232 Using MSCOMM
Hi,

I have an application in VB talking to a microprocerssor via RS232 COMport. Messages are in Command/Response format. However, response from microprocessor to PC can have different lengths (number sof bytes). Is there a way for the PC code to know if the end of a message has been reached? so it can read the receive buffer and process the data?

Thanks for any help.

Connecting To A GPS Using Rs232
I am trying to connect to a GPS using a VB app and the GPS vendor tells me that I need to enable the 7 PIN on the rs232 port that is the RTS (request to send) pin.

I have tried the following code from another posting but still can't get it to work

Private Sub Command1_Click()
MSComm1.CommPort = 1 ' set the port
MSComm1.Settings = "1200,n,8,1" ' set the settings
MSComm1.RThreshold = 1 ' how many characters received per onComm event
MSComm1.PortOpen = True ' open the port
End Sub

Private Sub MSComm1_OnComm()

Select Case MSComm1.CommEvent
Case comEvReceive
Text1.Text = MSComm1.Input
End Select
End Sub



I don't understand how I "enable" the 7 pin (RTS) that effectively starts the GPS running. Can any one help??

Rs232...(quite Urgent..)
Hi Friends,

In my application i need to receive string (ok ng) value from rs232 cable .the value will sent by microprocessor..


how to i convert the value into string??

or otherwise what mode i need to set in the mscomm control for receive string value??


waiting for your valuable reply...



with regards,
Krish..

Rs232 With Vb(quite Urgent)..
Hi friends,

in my application i need to read the value(weight) from weight machine..the weight machine connect thru rs232 cable..i understand that i need to use mscomm control..whenevr i receive i need to display in the textbox and once i receive i need to stored inside the database..

but how to i do ??

is there any example source??

if u have information or example source pls pass to me..

waiting for yuor value..

with regrads,
Krish..

RS232 COM Problem !
Hi i need to make communication with a device through COM port but for some reason i can't get input. When i'm using a com monitor program like docklight i send a command and the device respond, but when i try this from vb program(using MSComm Control) the device react on the command but i can't get response !? That's strange ! I'm handling OnComm event but there is no event to be handled after i send the command ! Any ideas ? Thanks in advance !!!!

USB-&gt;RS232 And MSComm32 ?
Hello,

Do one of you have any idea how to use a USB to RS232 dongle and the MSComm32.

My program work OK with a normal RS232 or a PCMCIA card , but whit the USB->RS232 , the only thing that move is the RTS DTS , but TX and RX , nothing ?

Any idea is welcome

Best Regards,
Didier.

Rs232 Problem...
how to set pin 3 (TxD) on rs232 always high?icould someone teach me...thanks...

Rs232+excel
anyone can provide me an example of code that receive data from rs232 and store it into notepad or excel.thank you

How Can I Get Data Through RS232 ?
How can I get data through RS232 ?

RS232 With MSComm
hello,
I have a function that transmit a string via MSComm.

I call this function in a timer every 100 msec.

sometimes (rarely) the delay between one transmit to the other transmit is more then 500 msec
anybody know what can cause such a thing?

I tried setting my application thread to 32 priority (which is realtime priority)so it will be the most important thread and that no other thread may enter before it and delay the transmits but still I get sometimes more then 500 msecs between two following transmits...

anybody have more ideas of how to solve this problem?
Yair

ActiveX And RS232
Does anyone know if you can access com ports through an Activex?
I have some simple code that works as an .exe but when I make it an Active X it doesn't work.

Basically trying to return data from a com port (a voltmeter in this case) through a browser, should this work or is com port access not allowed through a browser? G

RS232 Control
I would like to build a VB app with the ability to control pan/tilt/zoom operations of a Sony camera via RS232 com port.

Will I need to get a specific ActiveX control? and how is it best to do it.

Many thanks, Daniel.

Working With RS232
Can any body assist me in working with VB & RS232 (Code Required)

RS232-progrmming In VB6
Anyone who knows reference in programming in rs 232 in VB6 using XP OS

Rs232 Via Browser
Hi all,

Is there a way to send/receive data via rs232 from web browser?
In concrete I just need to enter 1-2 bytes in a form on web page,
and to send it on serial port. How can I do that?

RS232 COMMAND String
Can some one there help me please.

I need to build Command string to send to serial port (RS232) with Windows XP Proffesional

Com is COM1
Baudrate is 9600
Parity NONE
Stop bit 2



Protocol is:

Serial protocol FULL DUPLEX

ENQ
------------------------->
PC DEVICE
<-------------------------
ACK, NAK

error
<-------------------------
PC DEVICE
------------------------->


ENQ = reset communication (PASSWORD)
ACK = command acknoweledged
NAK = command not acknoweledged, try again
error = information about error type

-----------------------------------------------------------------------------------------------------------------------------------

command,question
------------------------->
PC DEVICE
<-------------------------
ACK, NAK

answer
<-------------------------
PC DEVICE
------------------------->




command and answer
STX + 0x03 + POINTER + ASCII1 + ASCII2 + ... + ASCII10 + ETX + CHK

question
STX + 0x03 + POINTER + ETX + CHK

where:
POINTER = 10 (but in hex format)
ASCII1 + ASCII2 = 2 (but in bcd format)
ASCII3 + ... + ASCII10 = some characters like words
where:
CHK = STX .Xor. CODE .Xor. POINTER .Xor. ASCII1 .Xor. ... .Xor.ETX




Please Help me

UPS Info (Status) - RS232
I want to implement in one of my VB progs a status info about a UPS connected to the PC with an RS232 cable, at least a power loss status. I tried to use HyperTerminal to view the UPS info strings and got no reply. It's possible to get this info as available on the supplied UPS (Mustek PowerMust 600VA Plus) commercial software Commander Pro?

Thanks in advance for any info on UPS/VB info.

RS232.vb - Events Not Fired
Hi friends
I am using RS232.vb class to develop an application to communicate with a card-reader attached to the serial port on my system. The code is working properly.
Data is sent and received properly. My problem is that none of the events of RS232.vb are fired.
My declaration line for RS232 class goes like this:

Public WithEvents CommPort As New Rs232

What should I do to get the events fired ?
Please help

thanks in advance

for your reference, RS232.vb is available at :
msdn.microsoft.com/library/en-us/dnvssamp/ html/vbcs_usingthecomportinvbnet.asp

Program Designed For RS232; Use With USB?
I made a comms proggy a while back, and one of the users is going to be running a laptop that doesn't have an RS232 plug for serial connections. There are USB converters available. Do I need to change anything in my app to accomidate USB support? If so, where can I find documentation on what needs to be changed?

Using MSCOMM control.

Thanks!

'Rekd

Rs232 Performance Issue
I have created an application which reads data from digital guages
using com1 serial port.

I can get my reading on screen no problem running the program from within vb,but when i compile the program and install it on the same pc
there is a long delay before i get my reading.

MMM....Why is there a delay after it is compiled.

Has anyone ever experienced this before..

Help (rs232 To Msaccess Database)
can anyone help

i can recieve data from my device but i try to update a access table with the recieved data it does not work correctly. my form has ado control on it connecting to the db.

vb
While blnStat = True

If MSComm1.InBufferCount Then
str = str & MSComm1.Input
txtFields(0) = Right(str, 23)
End If

DoEvents

Wend

when i add in the line (datPrimaryRS.Recordset.AddNew) into the if statement my recordset jumps three records each time.but when i manually add a record using the add button it works fine but does not work using code.mmm


has anyone got any source code to do a similar thing in access

RS232: Cross-platform IO?
Hey everyone,

I need to know if there is a way to output a value using VB that can be understood by another language like C/C++ without any error.

I also need some pointers on where to go to learn how to use this port. I need to perform handshaking, the whole thing.

Thanks,
+Q__

Possibly Very Easy (Using RS232), I Know Nothing!
Hi, I'm just starting Visual Basic programming. I need to make a program that is executed when i get a signal from the RS232 port. A external switch will be triggered, giving say a +5V input or something like that, and then the program will start. After the prgram runs there must be an output at the port, maybe an LED or something. If anyone has any suggestions it would be greatly appreciated. I've been looking all over using searches and gotten no where. Thank you!

Ryan

Getting Info From A Device Via RS232
Hello

i have received from the vendor of a device for cars the information in order to obtain a real time info from the engine.

Here is the info he has sended to me:


Quote:




Data starts streaming 15 seconds after power up.


> >Output Data Format
> >
> > RS 232
> >
> > Baud rate 9600
> >
> > Data 8 bit
> >
> > Parity None
> >
> > Stop 1 bit
> >
> > Flow Control None
> >


> > Header block
> > #00 null heading
> >
> > #01 start heading
> >
> > #02 start text
> >
> > Data block: data format
> >
> > AFR HEX 8 bit
> >
> > EGT LSB HEX 16 bit
> >
> > EGT MSB HEX 16 bit
> >
> > RPM LSB HEX 16 bit
> >
> > RPM MSB HEX 16 bit
> >
> > Boost LSB HEX 16 bit
> >
> > Boost MSB HEX signed
> >
> > TPS HEX 8 bit
> >
> > User1 HEX 8 bit
> >
> > Config Register HEX 8 bit
> >
> > Possible check sum of all of the above. Not implemented at this point.
> >
> > Data details:
> >
> > All 8 bit and 16 bit numbers need to be converted to decimal
equivalents.




i can connect to the device and receive a lot of info, and i have knowledge of vb, but i have not knowledge with the rs232 comms. Then im absolutly ko and i a dark hole without exit...

Can anyone give me the way in order to receive the info?

Thanks very very very much in advance.

Copyright © 2005-08 www.BigResource.com, All rights reserved