GSM-Forum

GSM-Forum (https://forum.gsmhosting.com/vbb/)
-   GSM Programming & Reverse Engineering (https://forum.gsmhosting.com/vbb/f83/)
-   -   Serial Port in VB .NET 2008 (https://forum.gsmhosting.com/vbb/f83/serial-port-vb-net-2008-a-688748/)

Dave.W 02-25-2009 12:09

Serial Port in VB .NET 2008
 
1 Attachment(s)
Hi,

Since I discovered the free download of Visual Studio .Net Express 2008 over at the microsoft site, I have had a small play bringing some of my VB 6 code over to the new standards.

Attached is a small sample I just wrote to communicate with the Serial Port.

The s/w enumerates all available ports automatically and data entred into the upper text box is transmitted to the port on clicking the Tx button. The data sent is terminated by vbCr character (chr(13)) but this can be modified in code.

Pauses are used to wait for any recieved data to be filled in the buffer, and the Rx data is then added to the RichTextBox. Again these can be modified or replaced by Do..While loops depending on what device you communicate with.

This is not the best way of working with VB.NET, I am reading a lot about threading at the moment. However this very simple code works in my application 100%, and hopefully it can give others a small head start.

Good luck!

Code:

Public Class Form1

    Dim comPorts As Array  'Com ports enumerated into here
    Dim rxBuff As String    'Buffer for receievd data

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'When the form loads
        'Enumerate available Com ports and add to ComboBox1
        comPorts = IO.Ports.SerialPort.GetPortNames()

        For i = 0 To UBound(comPorts)
            ComboBox1.Items.Add(comPorts(i))
        Next

        'Set ComboBox1 text to first available port
        ComboBox1.Text = ComboBox1.Items.Item(0)
        'Set SerialPort1 portname to first available port
        SerialPort1.PortName = ComboBox1.Text

        'Set remaining port attributes
        SerialPort1.BaudRate = 19200
        SerialPort1.Parity = IO.Ports.Parity.None
        SerialPort1.StopBits = IO.Ports.StopBits.One
        SerialPort1.DataBits = 8


    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'When Tx button clicked
        'Clear buffer
        rxBuff = ""

        'If port is closed, then open it
        If SerialPort1.IsOpen = False Then SerialPort1.Open()

        'Write this data to port
        SerialPort1.Write(TextBox1.Text & vbCr)

        'Pause for 800ms
        System.Threading.Thread.Sleep(800)

        'If the port is open, then close it
        If SerialPort1.IsOpen = True Then SerialPort1.Close()

        'If the buffer is still empty then no data. End sub
        If rxBuff = "" Then GoTo ends

        'Else display the recieved data in the RichTextBox
        RichTextBox1.Text = rxBuff

ends:
    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        'When ComboBox1 selection is changed, we need to update SerialPort1 with the new choise
        'But only if the port is closed!

        If SerialPort1.IsOpen = False Then
            SerialPort1.PortName = ComboBox1.Text
        Else : MsgBox("Operation only valid when port is closed.", MsgBoxStyle.Exclamation, "Error")

        End If

    End Sub

    Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
        'This sub gets called automatically when the com port recieves some data

        'Pause while all data is read
        System.Threading.Thread.Sleep(300)

        'Move recieved data into the buffer
        rxBuff = (SerialPort1.ReadExisting)

    End Sub

End Class


Dave.W 02-25-2009 12:21

Uses:

This program was intended for communicating with some industrial control application, but is working well with mobile phone over AT command set.

Tested with SE K850i connected on USB data link (PC Suite driver installed), and set to phone mode.

Send AT command "AT"
http://i4.photobucket.com/albums/y105/picogsm/AT-1.png

Send AT service request "AT*"
http://i4.photobucket.com/albums/y105/picogsm/AT-2.png

You can find details of AT command set HERE

Have fun!

vikramb1 03-09-2009 15:56

FBUS command for nokia 1600
 
Sir would u plz tell how to read nokia firmware detail with usb ....coz i am sending FBUS command to phone command sent sucssesfully but didn't get answer from phone would u plz give some help how to communicate with phone with Visual Basic just read phone type and imei.....

Thanks a lot

-luigi- 03-10-2009 13:12

Sending SMS using .NET sOURCE Code!!!
 
Hi. As it was not easy for me to find a source code, I will put the page here for make easy for the people:

http://www.codeproject.com/KB/IP/Sen...using_Net.aspx

if you are using VB8, I recommend u to read this:
https://forum.gsmhosting.com/vbb/f83/serial-port-vb-net-2008-a-688748/

Dave.W 03-10-2009 13:43

Code in both links is the same thing, only the top link has the added AT command for sensind SMS.

Also, you will have problems using that with most manufaturers mobile, as it is working with TEXT mode SMS. Most big manufacturer support only PDU mode.

You can find info how to make PDU text messages at: http://www.embedtronics.com/nokia/fbus.html

I will merge this with the sticky thread - to make it more accessable for others :)

Dave.W 03-10-2009 13:52

Quote:

Originally Posted by vikramb1 (Post 4229404)
Sir would u plz tell how to read nokia firmware detail with usb ....coz i am sending FBUS command to phone command sent sucssesfully but didn't get answer from phone would u plz give some help how to communicate with phone with Visual Basic just read phone type and imei.....

Thanks a lot


The source code posted above is for sending AT commands only, you must modify it to send FBUS commands.

AT command = string data
FBUS = hex data

You can find examples how to send FBUS in visual basic by searching the forum, this can be converted to .NET quite easy :)

vikramb1 03-13-2009 19:10

how to read from port in VB6
 
Sir thanks for reply,

actually i am trying to read phones type and imei through FBUS, sending command with MSCOMM in hex values....but didn't get answer from phone how to read data from port and put in string don't get ....

data written to com port sucessfully seen in sniffer but unable to catch answer....

vikramb1 03-13-2009 19:12

how to read from port in VB6
 
Sir thanks for reply,

actually i am trying to read phones type and imei through FBUS, sending command with MSCOMM in hex values....but didn't get answer from phone how to read data from port and put in string don't get ....

data written to com port sucessfully seen in sniffer but unable to catch answer....
phone is nokia 1600 connected to usb.

cool_guy4ever15 03-27-2009 22:34

hi sir

i've downloaded the attachmet and when i tried to open the program it gives me an error and didn't open.

i wanna to interface Ericsson T290i with AT COmmand i want when the mobile recieve a message it converts it to binary code that microcontroller understand it to turn on/off devices.

i want to know how could i read message from the program i downloaded coz i tried with hyper terminal it gives me error in the reding msg code. so plz i want u to help me

sorry if i ask silly question i havn't worked with visual studio before

i hope u understand me.

Dave.W 03-28-2009 08:40

you must download also the visual studio package from the first link. There is some core files needed to run the exe

vikramb1 03-28-2009 09:54

how to read buffer from comm port
 
Sir when i send command to phone in hex i unable to catch ACK from phone in which event i write code or how i get or read answer from phone plz help

Dave.W 03-29-2009 10:25

1 Attachment(s)
Seems you are using VB6, so why are you posting your question in this thread? You should make a new, or better still make a forum search.

Any way, take the attachment. Its simple com port source code in VB6, very old source. It is already posted in the forum a few times.

JayDi 03-29-2009 14:39

Dave.W, can You explain little more about sending comand via usb and recived answer back procedure?
I'm coding on delphi, and i found very small info about that on forum...
I've seen on this section some code for Delphi by SEMC, but i can't understand how do that...
Thanks... and Sorry, if i post in wrong section...

Dave.W 03-29-2009 21:04

Hi JayDi,

All I know is in the first post really. You must install SEMC Data suite then the mobile becomes like a virtual com and you can access with serial port control.

I suppose there is other levels of communication also.

code-R 03-31-2009 05:24

is available for delphi ???

Dave.W 03-31-2009 21:07

I think there must be many sources out there for delphi in the net already.

Visual studio is a relativly new kind of language, with very few websites helping with serial comms, thats why I post here :)

infogsm 04-01-2009 00:39

thx man it s very interesting for beginners !!
br

cool_guy4ever15 04-02-2009 00:46

thanks man i've worked with t290i and AT Command it works well.

now i'll try to make the MCU recieve the msg that the mobile recieve automatically and switch on/off devices

dr_aybyd 05-17-2009 10:44

hi, Dave.W
i got this error when I sent this AT Command AT+CPBR=1,250
that command is for phonebook extraction

System.InvalidOperationException was unhandled
Message="The port is closed."
Source="System"
StackTrace:
at System.IO.Ports.SerialPort.ReadExisting() at SerialPort_Test.Form1.SerialPort1_DataReceived(Obj ect sender, SerialDataReceivedEventArgs e) in C:\Documents and Settings\Administrator\My Documents\Downloads\SerialPort_Test\SerialPort_Tes t\SerialPort_Test\Form1.vb:line 74 at System.IO.Ports.SerialPort.CatchReceivedEvents(Obj ect src, SerialDataReceivedEventArgs e) at System.IO.Ports.SerialStream.EventLoopRunner.CallR eceiveEvents(Object state) at System.Threading._ThreadPoolWaitCallback.WaitCallb ack_Context(Object state) at System.Threading.ExecutionContext.runTryCode(Objec t userData) at System.Runtime.CompilerServices.RuntimeHelpers.Exe cuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.ExecutionContext.RunInternal(Exec utionContext executionContext, ContextCallback callback, Object state) at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state) at System.Threading._ThreadPoolWaitCallback.PerformWa itCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack) at System.Threading._ThreadPoolWaitCallback.PerformWa itCallback(Object state)
InnerException:

satmosc 08-17-2009 22:14

it is really easier in C# .net , and specially , You can compile and MSL for later compile for linux.

wahidgmx 10-23-2009 22:24

tnx guys For this Nice topic

costel_mcb 02-28-2010 15:46

Dave.W can explain how can i send nck codes via usb to nokia bb5 phones, i try to use at comand but not all phones have "Phone to Network Lock" facility Enabled

AswanX 03-08-2010 20:20

thx man it s very interesting for beginners !!

ufsx002 05-26-2010 19:00

Dim i As VariantType

ufsx002 05-26-2010 19:13

2 Attachment(s)
Dim i As VariantType

calvinpower 06-08-2010 22:28

Dave.W
 
I want to write an application using visualbasic2008 which will run on my PC and communicate to a mobile phone using AT commands. ( nokia 1202, 1203)
like reading phone imei, security code, restore factory state, unlock sp lock

Dave.W 06-09-2010 08:15

Quote:

Originally Posted by calvinpower (Post 5940456)
I want to write an application using visualbasic2008 which will run on my PC and communicate to a mobile phone using AT commands. ( nokia 1202, 1203)
like reading phone imei, security code, restore factory state, unlock sp lock

Yes, read post 1 and 2 in this thread!

calvinpower 06-09-2010 21:37

cool man. but where to find AT COMMANDS

Dave.W 06-10-2010 08:16

Quote:

Originally Posted by calvinpower (Post 5944571)
cool man. but where to find AT COMMANDS

Read post number 2, all is posted.

calvinpower 06-10-2010 10:57

Dave.W
 
its grateful that u have provided me with such a beatiful and simple tutorial. i was in search of such tutorial for long a time.
I have managed to add a progressivebar and a timer. I am about to start prepairing gsm AT commands like read imei, firmware version, model , make and so forth. please guide me how to send all AT commands at once. and please can you give me AT commands for " read security code, write flash etc...etc..

mustipusti 06-10-2010 12:16

Quote:

Originally Posted by calvinpower (Post 5946495)
its grateful that u have provided me with such a beatiful and simple tutorial. i was in search of such tutorial for long a time.
I have managed to add a progressivebar and a timer. I am about to start prepairing gsm AT commands like read imei, firmware version, model , make and so forth. please guide me how to send all AT commands at once. and please can you give me AT commands for " read security code, write flash etc...etc..

hehe there are no at commands for write flash / read security code :D

calvinpower 06-10-2010 13:51

can this (JAU Delphi Sources) be converted to vb ? or c++

adityajha 11-09-2010 13:17

HOW to get device id in VB 2008,bcz in this code only available com port is showing but my question is how i get dtail of attached device or how to filter proper device by serial port in vb 2008.

Dave.W 11-10-2010 09:34

Quote:

Originally Posted by adityajha (Post 6547502)
how to filter proper device by serial port in vb 2008.

- Get list of all ports
- Send a command with known response to each port in turn
- Monitor response.

For example send AT command "AT?" to each port. If Returned data is "ATOK" then you know is connected an AT compatible device. If not then try next port.

Now you can check identity of connected device.

Good luck.

adityajha 11-10-2010 09:46

Quote:

Originally Posted by Dave.W (Post 6550607)
- Get list of all ports
- Send a command with known response to each port in turn
- Monitor response.

For example send AT command "AT?" to each port. If Returned data is "ATOK" then you know is connected an AT compatible device. If not then try next port.

Now you can check identity of connected device.

Good luck.

thanks 4 ur reply i kno what u r saying but i want proper device name in combo box.we r using AT for check which port is connected ,but i want list of all connected device .

New Microsoft Word Document.doc

can u got my topic and give me pfoper command for that.

Dave.W 11-10-2010 10:07

There is no such thing like that using serial ports. You must study how to use USB. You can find source by fr3nsis in the fourm, it will help you.

Good luck.

hiramlight 05-07-2011 09:57

Hello,

I know it has being a long time since this post was created, but I am trying to communicate with an Encoder using Silicom Lab CP210X USB/UART bridge , at first I use a RS 232 class , couldn't get any reply from the encoder ( The hardware is good as the hotel is using it during the day with the C++ application who come with it) , then I tried AnySerialPOrt , a very nice C# app written by Orhan who let you build driver for serial port, still no reply, the format in which the string has to be sent is at follow.

The EIA RS232C standard interface is employed to connect ADEL interface network system with the hotel management system.
3.1.2 Data Format

Data format: 1 start bit, 1 end bit, 8 data bits, no verification; The communication rate is from 2400bps to 19200bps.
3.2 Data Protocol

3.2.1 Control Character

STX (0x02):Tag the beginning of the data.
ETX (0x03): Tag the end of the data.
ENQ (0x05): Test the connection.
ACK (0x06): Response to the end which transmits the data and show that the transmitted data is correct.
NAK (0x15): Response to the end which transmits the data and show that the transmitted data is wrong.
RS (0x1E): Tag the beginning of the new field (region) and is followed by the field identification code.
3.2.2 Information Format

Information format: <STX>ddssff[data]<ETX>cc
When the receiving end gets the information complying with the above format, it will respond with “ACK” if the calculated verification is same as the received verification. Otherwise, it will respond with “NAK”. The above responses (ACK and NAK) are applied to check the data integrality. They show neither the data content nor whether the execution result is right or wrong.

Information Field
Description
dd
Destination address, target (client) address
ss
Source address which tags the information source
ff
Command or answer code
[data]
Data region (optional)
Destination address:
2-byte; virtual value: 00 to 99. Receive the information destination address or designate the client end to execute the commands.
Source address:
2-byte; virtual value: 00 to 99 (00 is reserved by the system). Tag the information source.
Command code:
1 byte ASCII code. Specify the command to be executed.

Check character:
2-byte;
Algorithm: Use 0x00 as the seed to do XOR with all the data after STX. The result of each XOR will be used as the new seed for the next XOR. The final 1-byte result will be transformed into a 2-byte hexadecimal ASCII code.
Example:
STX
0x30
0x39
0x52
ETX
C1
C2

First calculation: 0x00 XOR 0x30 = 0x30
Second calculation: 0x30 XOR 0x39 = 0x09
Third calculation: 0x09 XOR 0x52 = 0x5B
Forth calculation: 0x5B XOR 0x03 = 0x58
Verification code of the first byte (C1): 0x5 ->ASCII 5 = 0x35
Verification code of the second byte (C2): 0x8 ->ASCII 8 = 0x38

/////////////////////////////////

I build the HEX convert module to XOR the data, when I send a string like <STX>0103E<ETX>CC, I expect a ACK or NAVK back if my dta is incorrect , but herre nothing, just:
=======================
<20110403184211.296 SYS>
Set timeouts: ReadInterval=100, ReadTotalTimeoutMultiplier=2000, ReadTotalTimeoutConstant=2000, WriteTotalTimeoutMultiplier=0, WriteTotalTimeoutConstant=0
<20110403184251.335 SYS>
Purge the serial port: RXCLEAR, TXCLEAR
<20110403184257.523 TX>
<STX>0103E<ETX>44
<20110403184439.616 SYS>
COM port is closed

======================

when checking with a serial monitor the data TX and TX to the enocder from the C encoder software I get those stange ASCSII char :

===================
000043: I/O Request (UP), 29.03.2011 16:47:51.090 +0.0
IOCTL_SERIAL_PURGE: Purge requests
000044: Write Request (DOWN), 29.03.2011 16:47:51.090 +0.0
Buffer size: 0x16 bytes
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 7E ˙˙˙˙˙˙˙˙˙˙˙˙˙˙˙~
FF 00 DF 0B 17 7E ˙.ß..~
000049: Read Request (UP), 29.03.2011 16:47:51.121 +0.0
Buffer size: 0x1 bytes
Status: 0x00000000
7E
...ETC>>>>>>>>>>>>>
==================

I think this is coming from the silicom Lab bridge ...

I would appreciate any ideas or suggestion or if anyone has worked with Silicom lab bridge before ..
Cheer's

Alan

raghavroy 05-17-2011 10:08

problem in activating com port through usb to com port converter can u pls guide anyone

::gsmcoder:: 05-20-2011 19:30

waooooooooooooooo i have modified the string to send fbus commands, perfect, thanks dev, my programming skills are advancing

::gsmcoder:: 05-20-2011 19:31

Quote:

Originally Posted by calvinpower (Post 5947255)
can this (JAU Delphi Sources) be converted to vb ? or c++

working perfect in vb, tested by me

adeel ur rehman 06-30-2011 13:28

how to read data from serial port:
sir i have a problem in receiving data through serial port . i have project in i have to receive
voltage value through serial port please help me and send coding in vb.net
Thanks in advance...............

ck2udgr43 08-26-2011 12:07

In fact dr dre beats studio headphones, the new school days in *******, shandong dongying city in a school in heilongjiang, Harbin minjiang elementary school... Many Chinese school Red dr dre headphones, has a garden and the elements. Even some school brand edge is hung with "Chinese garden" and signs.
Many of the details of the book became a classic case of education workers, some teachers will take classmates said to "ZhangDouDou" folding headphone, "WangDouDou", most of the bad character called "steel beans".
But SunYunXiao and bestseller, "the good mother is better than a good teacher," the author of YinJianLi all say "China is not true top studio headphones," the garden.

workpiece091 10-14-2011 05:00

[img]http://www.mercurialvaporsuperflyii.com/images/****-mercurial-superfly-iii-fg/****-mercurial-vapor-superfly-iii-fg-red-gold-no02011015-********-boots.jpg[/img]
**** Mercurial Vapor Superfly Iii Fg Red Gold No02011015 Footbrawl Boots,****** AdiPURE IV
Next up in the band of inaperture analysiss is the **** PWR-C 3.10. The abilityCat alternation is advised with one affair in apperception,****** Absolado X, power. And this PWR-C 3.10 absolution avalanche appropriate in line with the tchamp. The big account to this recharter is that **** accumulate it at an allowable amount while ensuring you get a top akin of backbone and achievement. For analysising, **** beatific over a brace of the Babridgement/White/Aged Silver blushway.
It took best than I would accept adapted to get these calm ***** torn in. The solebowl in accurate proved to be boxy, with a annealed activity from the aboriginal affair cutting them. I concluded up wearing them about as an accustomed shoe in an attack to alleviate them up. Size astute,****** F50 Adizero, these are not acceptable for advanced bottomed amateurs. If you attending at the cossack from aloft, it absolutely anchorage in on the toes crbistro a actual bound fit. This aswell accepted to actualize a claiming thasperous tebite &n43760f1ba35dc394eb55fbairn117d5ef; my admonition is to in fact adjustment up a bisected-admeasurement to enabiding you get a added adequate fit.

Spoochy 10-24-2011 00:32

Wake up Dave. ;) Two spammers needed to be killed.

Darkensser 03-24-2012 00:51

Wwwaaoo nice post... Thanks!!! VB.NET ADVANCED! :)

ameenudeen 06-16-2012 13:04

pls hap
 
HTML code is Off
.................................................

vivachillon 06-24-2012 17:41

thanks friend!!!!!!!!!

selular88 10-09-2012 13:49

does SerialPort in VB.Net supports wavecom?
please help me, maybe I am the one who is mistaken

Here's the at command code :
Code:

ATZ
OK
AT+CMGL="ALL"
+CMGL: 1,"REC READ","+6285289983333",,"12/10/08,11:52:20+28"
sms gateway read again and again
+CMGL: 2,"REC UNREAD","+6285289983333",,"12/10/08,12:32:24+28"
TESTING RECEIVE SMS
+CMGL: 3,"REC READ","+6285289983333",,"12/10/08,12:08:17+28"
read sms again

OK
AT+CMGD=1
OK
AT+CMGL="ALL"
+CMGL: 2,"REC READ","+6285289983333",,"12/10/08,12:32:24+28"
TESTING RECEIVE SMS
+CMGL: 3,"REC READ","+6285289983333",,"12/10/08,12:08:17+28"
read sms again

OK

AT+CGMI
 WAVECOM MODEM

OK
AT+CGMM
 MULTIBAND  900E  1800

OK
AT+CGMR
640_09gg.Q2303A 1264860 052103 11:21

OK
AT+CGSN
354056000341739

it works well on hyperterminal, but return nothing from SerialPort Class

[Shadab_M] 10-11-2012 06:43

Serial Port will support every thing based on Serial Protocol.

May be you are not sending vbCRLF with commands?

Br,
Shadab Ahmad

selular88 10-12-2012 06:59

Hai Shadab Ahmad, thanks for your reply
I used your application for modem 1206B/Q2303A

Here is the code :
Code:

Public Class Form1

    Dim comPorts As Array  'Com ports enumerated into here
    Dim rxBuff As String    'Buffer for receievd data

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'When the form loads
        'Enumerate available Com ports and add to ComboBox1
        comPorts = IO.Ports.SerialPort.GetPortNames()

        For i = 0 To UBound(comPorts)
            ComboBox1.Items.Add(comPorts(i))
        Next

        'Set ComboBox1 text to first available port
        ComboBox1.Text = ComboBox1.Items.Item(0)
        'Set SerialPort1 portname to first available port
        SerialPort1.PortName = ComboBox1.Text

        'Set remaining port attributes
        SerialPort1.BaudRate = 19200
        SerialPort1.Parity = IO.Ports.Parity.None
        SerialPort1.StopBits = IO.Ports.StopBits.One
        SerialPort1.DataBits = 8


    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'When Tx button clicked
        'Clear buffer
        rxBuff = ""

        'If port is closed, then open it
        If SerialPort1.IsOpen = False Then SerialPort1.Open()

        'Write this data to port
        SerialPort1.Write(TextBox1.Text & vbCr)

        'Pause for 800ms
        System.Threading.Thread.Sleep(800)

        'If the port is open, then close it
        If SerialPort1.IsOpen = True Then SerialPort1.Close()

        'If the buffer is still empty then no data. End sub
        If rxBuff = "" Then GoTo ends

        'Else display the recieved data in the RichTextBox
        RichTextBox1.Text = rxBuff

ends:
    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        'When ComboBox1 selection is changed, we need to update SerialPort1 with the new choise
        'But only if the port is closed!

        If SerialPort1.IsOpen = False Then
            SerialPort1.PortName = ComboBox1.Text
        Else : MsgBox("Operation only valid when port is closed.", MsgBoxStyle.Exclamation, "Error")

        End If

    End Sub

    Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
        'This sub gets called automatically when the com port recieves some data

        'Pause while all data is read
        System.Threading.Thread.Sleep(300)

        'Move recieved data into the buffer
        rxBuff = (SerialPort1.ReadExisting)

    End Sub

End Class



All times are GMT +1. The time now is 16:53.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
- GSM Hosting Ltd. - 1999-2023 -

Page generated in 0.36677 seconds with 6 queries

SEO by vBSEO