Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 38
  • Last Modified:

How to pass this in Serial port comunication : <SOH><LF> in vb.net

i have some code for serial port comunication.
-----
<SOH><LF>
09_Cobas_Integra_09<LF>
<STX><LF>
10_01<LF>
<EFX><LF>
1<LF>
625<LF>
<EOT><LF>
--
how to pass this code in vb.net for serial port communication.
0
rajeshavyas
Asked:
rajeshavyas
2 Solutions
 
ste5anSenior DeveloperCommented:
Byte by byte. Either as byte array or as string.
0
 
Fernando SotoCommented:
Hi  rajeshavyas;

What I think you are looking for is first to convert all your control codes such as <SOH>, <LF>, <STX> and so on to their ASCII code values. For example <SOH> is Start Of Heading which has a numeric value of 1 and <LF> which is Line Feed and has a value of 10 and everything else represents itself. Place into a Byte array or a string like this.
Dim sendThis = Chr(1) & Chr(10) & "09_Cobas_Integra_09" & Chr(10) & Chr(2) & "10_01" & Chr(10)

Open in new window

Although I do not know what <EFX> is? It may be a device specific code. Below is the beginning of the ASCII table that has the control codes. You may need to add a reference to Microsoft.VisualBasic.dll and use the Imports Microsoft.VisualBasicASCII Control Codes
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now