Recently we have connected one bluetooth device which receive data from our serial device. The bluetooth device further transmite this data to a Windows Mobile which is bluetooth enable. Baud rate of whole system is 19200 with 7 data bit and 1 stop bit.When we send command to serial device through bluetooth device it is accepting the command and respond accordingly. but some of data byte of string is desplay as question mark (?).
But in case we connect the serial device directly to PC, the string received is correct.
Code of vb.net program which I run in windows mobile is below:
Imports System
Imports System.IO.Ports
Imports System.Windows.Forms.TextBox
Public Class frmSelectComPort
Dim WithEvent port1 as serialport = _
New SerialPort(“Com2”,19200,Parity.Even, 7, StopBits.One)
Private Sub MnuConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuConnect.Click
If port1.IsOpen Then
port1.Close()
End If
port1.DtrEnable = True
port1.RtsEnable = True
port1.ReceivedBytesThreshold = 1
port1.Open()
Dim str1,strcmd,strReadSegment0 As String
Str1="09RD000001"
strchksum=23
strcmd = New String(Chr(2) + str1 + Chr(3) + strchksum) + Chr(0)
Delay(5000)
port1.Write(strcmd, 0, strcmd.Length)
System.Threading.Thread.Sleep(70)
Delay(2000)
strReadSegment0 = port1.ReadExisting
‘here I receive the following string "?09?D03?A D?
End Sub
Private Sub Delay(ByVal num As Double)
Dim i As Double
For i = 0 To num
Next
End Sub
End Class
Command Given to Serial Port is " 09RD000001 23
Response given by Serial Port is "?09?D03?A D?
But I Expect the following input from serial port : " 09RD033A DA
Kindly provide the solution ASAP
Have you tried 8 databits, no parity, 1 stop bit? As long as both ends are set the same...
The ? can indicate that the encoding needs to be set.
Dim myEnc As Encoding = Encoding.GetEncoding("Windows-1252")
port1.encoding=myEnc
Related
I have a camera management system with the following components in vb.net
This has worked well for several years, but is now randomly failing in different programs with a 'file not found' error when accessing the memory file or simply freezing. This occurred after I added a new memory file (GPS2Memory) The design of the system is to have several data readers assembling data from a their own data streams and overwriting the prior values , while 3 control applications read these records and control servos. These actions are asynchronous.
I have tried deleting the MMF.Dispose but the apps continue to fail.
CreateMemoryFiles - Creates 5 memory files (Switch_Memory, INS_Memory, GPS_Memory, AHRS_Memory, GPS2Memory) each is 400 bytes except Switch - which is 20.
ReadAHRS reads a data stream on a com port, and places a formatted csv string in AHRSMemory about every 50 ms.
ReadSecondGPS reads a data stream on a com port and places a formatted csv string in GPS2Memory about every 30 ms.
ReadIMUData reads a data stream on a com port and places a formatted csv string in IMU_Memory about every 30 ms.
ReadSwitch reads a switch status on a USB port and places a formatted csv string in SwitchMemory about every 50 ms.
BankCompensator reads IMU_Memory (for roll data), and SwitchMemory (On or Off) to start servo control.
CameraControl reads GPS2Memory (for WAAS data) IMUMemory (for pitch, roll and heading) and SwitchMemory for starting an stopping servos and shutter events.
I have run all programs in Debug mode :
ReadSecondGPS failed after 16843 cycles - Failed on 'Openexisting" statement with 'Unable to find specified file.
ReadAHRS failed after 12652 cycles, with same error and message
ReadIMUData failed after 45331 cycles with same message
CreateMemoryFiles was still running and when I set a breakpoint, it was at 3679 cycles (Incrementing every 1000 ms) and continued.
I have tested the string length written to the files, and the longest is 109 characters - I set the length longer as the strings get more data as new data becomes available.
Why would Windows lose track of 3 memory files when the initiator was still active?
Here is the create code - this is an endless loop so the memory files should not disappear.
Option Explicit On
Option Strict On
Imports System
Imports System.Net
Imports System.Text
Imports System.IO
Imports System.IO.MemoryMappedFiles
Imports System.Timers
Imports System.Threading
Public Class Form1
Public WithEvents MEMSTimer As New System.Windows.Forms.Timer()
Dim LoopForever As Boolean = True
ReadOnly GPSINS_Memory_File_Name As String = "GPSINSMemoryData"
ReadOnly GPS2_Memory_File_Name As String = "GPRMCmemoryData"
ReadOnly AHRS_Memory_File_Name As String = "AHRSMemoryData"
ReadOnly Switch_Memory_File_Name As String = "SwitchMemoryData"
Dim CycleCount As Integer = 1
Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim GPS2 = MemoryMappedFile.CreateNew(GPS2_Memory_File_Name, 20, MemoryMappedFileAccess.ReadWrite)
Dim MMS = MemoryMappedFile.CreateNew(Switch_Memory_File_Name, 400, MemoryMappedFileAccess.ReadWrite)
Dim GPS = MemoryMappedFile.CreateNew(GPSINS_Memory_File_Name, 400, MemoryMappedFileAccess.ReadWrite)
Dim AHRS = MemoryMappedFile.CreateNew(AHRS_Memory_File_Name, 400, MemoryMappedFileAccess.ReadWrite)
CycleCountOut.Text = CType(CycleCount, String)
Do Until LoopForever = False
CycleCount += 1
CycleCountOut.Clear()
CycleCountOut.Text = CType(CycleCount, String)
Thread.Sleep(1000)
Loop
Application.Exit()
End Sub
Public Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
LoopForever = False
Application.Exit()
End Sub
Private Sub CycleCountOut_TextChanged(sender As Object, e As EventArgs) Handles CycleCountOut.TextChanged
End Sub
End Class
Here is a typical Write code
Sub WriteAHRS_To_Memory()
Dim MMF = MemoryMappedFile.OpenExisting(AHRS_Memory_File_Name)
Dim Bytes As Byte()
Bytes = StrToByteArray(AHRS_Data_Out)
Try
Using writer = MMF.CreateViewAccessor(0, Bytes.Length)
writer.WriteArray(Of Byte)(0, Bytes, 0, Bytes.Length)
' writer.Dispose()
End Using
Catch ex As Exception
MsgBox("mem write error = " & ex.ToString)
End Try
stop_time = Now
AHRS_elapsed_time = stop_time.Subtract(start_time)
AHRS_Update_Time.Clear()
AHRS_Update_Time.AppendText(AHRS_elapsed_time.TotalSeconds.ToString("0.000000"))
start_time = Now
MMF.Dispose()
End Sub
And typical Read code
Sub GetIMUData()
Dim MMS = MemoryMappedFile.OpenExisting(Switch_Memory_File_Name)
Using Switchreader = MMS.CreateViewAccessor(0, 20, MemoryMappedFileAccess.Read)
Dim SwitchByteString = New Byte(20) {}
Switchreader.ReadArray(Of Byte)(0, SwitchByteString, 0, SwitchByteString.Length)
outMessage = Convert.ToString(SwitchByteString)
teststring = ""
teststring = BitConverter.ToString(SwitchByteString)
For i As Integer = 0 To SwitchByteString.Length - 1
SwitchdataIn = System.Text.Encoding.ASCII.GetString(SwitchByteString)
Next
End Using
Dim SwitchString() As String
SwitchString = Split(SwitchdataIn, ",")
SwitchdataIn = SwitchString(0)
SwitchPositionDisplay.Clear()
SwitchPositionDisplay.Text = SwitchdataIn
MMS.Dispose()
I am trying to read out some serial data from my STM32 board to GUI, and also, I have trouble closing down my serial communication port.
I am using 2013 Visual Studio and chose Visual Basic as my programming language. What I wanted to send from the microcontroller is some serial data that I sent byte-by-byte. So, for example, I will be sending "<abcde>" from my microcontroller with "<" and ">" as my start and stop bit; and hopefully my visual basic GUI will read and display it.
I have tried to display it at visual basic using serialport.readexisting() with no problem, but then I need to separate each bytes by itself. In the end, I wanted my program to read and process each byte, which will be some sensor values and can display it in the VB program.
I have tried using both serialport.read() and serialport.readbyte() but I don't know why, it does not show the correct output. What I meant of not correct is that the ascii code nor characters does not represent on what I sent from the microcontroller.
Here is the time when I use readbyte().
'Visual Basic --> for serialport.readbyte()
Dim buff_rx As Byte
Private Sub SerialPort1_DataReceived_1(sender As Object, e As SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
SerialPort1.ReadTimeout = 20
Do While SerialPort1.BytesToRead > 0
Try
buff_rx = SerialPort1.ReadByte
Me.Invoke(New EventHandler(AddressOf update_dat))
Catch ex As Exception
End Try
Loop
End Sub
Public Sub update_dat(ByVal sender As Object, ByVal e As System.EventArgs)
Dim i As Integer = buff_rx
Dim s As String = ""
s = i.ToString("X2") 'if wanted to be in hex, use "X2"
Rx_text.Text = Rx_text.Text & " " & i
End Sub
Here is the part when I tried using the read() part.
'Visual Basic --> for serialport1.read()
Private Sub SerialPort1_DataReceived_1(sender As Object, e As SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
Dim bytestoread As Int16
bytestoread = SerialPort1.BytesToRead
Dim buff(bytestoread) As Byte
ReceivedText(SerialPort1.Read(buff, 0, bytestoread - 1))
End Sub
Private Sub ReceivedText(ByVal [text] As String)
If Me.Rx_text.InvokeRequired Then 'form 1 is Me'
Dim k As New SetTextCallback(AddressOf ReceivedText)
Me.Invoke(k, New Object() {(text)})
Else
Me.Rx_text.Text &= [text]
End If
End Sub
This part below is when I send the data from microcontroller
//Microcontroller side, data sending
tx3_buff[0] = '<'; //ascii code: 60
tx3_buff[1] = 'b'; //ascii code: 98
tx3_buff[2] = 'c'; //ascii code: 99
tx3_buff[3] = 'd'; //ascii code: 100
tx3_buff[4] = 'e'; //ascii code: 101
tx3_buff[5] = 'f'; //ascii code: 102
tx3_buff[6] = 'g'; //ascii code: 103
tx3_buff[7] = 'h'; //ascii code: 104
tx3_buff[8] = 'i'; //ascii code: 105
tx3_buff[9] = '>'; //ascii code: 62
The data that I was intended to send from the microcrontroller are shown on the code as well. As I mentioned before, when I used the serialport.readexisting(), I can correctly read "". But when I use either serialport.readbyte() and serialport.read() it reads:
160 16 161 33 198 18 52 68 84 200 232 16 40 200
and so on and so on which is definitely incorrect and made nonsense.
In terms of the close() problem, I put the serialport.close() inside the button function. I already tried from some forums that stated we should use begininvoke instead of only using invoke (like here: https://blogs.msdn.microsoft.com/bclteam/2006/10/10/top-5-serialport-tips-kim-hamilton/)
But it still won't work.
Here is the Close button part:
'Visual Basic --> for disconnect button
Private Sub Button5_Click_1(sender As Object, e As EventArgs) Handles Button5.Click
SerialPort1.Close()
End Sub
Everytime after I pressed this button, it will always be stuck and hanged. I need to restart the program so this problem will be solved. Any ideas for this part?
To easily summarize, here are my problems:
I have literally no idea how to use the serialport.readbyte() and serialport.read(). I really need this as I wanted to separate the data byte-by-byte so I can process it easily.
The serialport.close() button always hangs and I don't know why.
I hope someone can help me with these problems. Thank you in advance for all your help and sorry if my thread is messy!
Thank you again!
Buff_Rx is a byte array and can't be assigned to an integer:
Dim i As Integer = buff_rx
I am programming a windows form that will communicate with a microcontroller.
After the winform is loaded, it should automatically detect the comport where the microcontroller is connected .
What I am doing is:
- Get the names of the available ports
- with a loop through these names :
- assign the port name to the serial port instance in the form
- send a command for the detection
- wait some time
- check if some text has been received
- compare the received message to the identification message
- if it is the right one break the loop and return the result, if not
continue
Below is the code of the function. I am using thread.sleep method. But the function is not working and I don't detect the board when it is there.
Can You tell me what is wrong with the function? Is the time delay blocking the reception? how should I ameliorate it?
This function is excuted at the beginning after loading the form. If I don't find the port, nothing can go forward. On the other side, there are no other threads I have to take into account at that stage of the excution. I thought about the DatarRceived Event, but it does not make sense at this stage, it will be activated after the right port has been detected.
Please let me know what you think
thank you
Public Function connect(testport As SerialPort, recognizeText As String, userCommand As String) As Boolean
Dim intReturnASCII As Integer = 0
Dim charReturnValue = Chr(intReturnASCII)
Dim returnMessage As String = ""
Dim count As Integer = 0
Dim ports As String() = IO.Ports.SerialPort.GetPortNames
If testport.IsOpen Then
testport.Close()
End If
Try
For Each newport As String In ports
testport.PortName = newport
testport.Open()
testport.Write(STX & userCommand & ETX)
Thread.Sleep(200) ' stop the userform and wait for the reception of the response
count = testport.BytesToRead
While count > 0
intReturnASCII = testport.ReadByte
returnMessage = returnMessage + Convert.ToChar(intReturnASCII)
count -= 1
End While
testport.Close()
XMCPort = newport ' Danach instantiate the serial port publicly with port name , is true instantiate
If returnMessage.Contains(recognizeText) Then
Return True
End If
Next
Return False
Catch ex As Exception
Return False
End Try
count = 0
returnMessage = ""
End Function
I have a hardware with USB for communicate between computer to hardware. The vendor not giving any APIs to connect to the device. They give me a protocol. But the protocol is serve for RS232 mode. I ask the vendor whether this protocol can be apply to the USB, they said 'YES'.. So, I'm thirst of idea how to use this protocol. Does anyone know? My old friend said yes I can use the USB and treat is as COM which I need to create an object. Create instance of the object which declare as a serialport as below. But it still can't get the status.
Public Sub New(ByVal intComNumber As Integer, ByVal lngBaudRate As Long, ByVal intDataLng As Integer, ByVal intStopBit As Integer, ByVal intParity As Integer)
Try
objUPSPort = New SerialPort
With objUPSPort
.PortName = ("COM" & intComNumber)
.BaudRate = lngBaudRate
.DataBits = intDataLng
.StopBits = intStopBit
.Parity = intParity
.Handshake = Handshake.None
End With
Catch ex As Exception
MsgBox("Error In Init UPSComm")
End Try
End Sub
Can someone help me identified this? This hardware is UPS. A simple command write to the port. But I get the error when get status. Below is the code to write to the UPS.
Public Function GetStatus() As String
Dim strRet As String
Dim strRecv As String
Dim byteRead() As Byte
Try
If Not IsNothing(objUPSPort) Then
objUPSPort.Open()
objUPSPort.WriteLine("Command will be here" & vbCrLf)
For i = 0 To 100000
If objUPSPort.BytesToRead >= 45 Then
Exit For
End If
Next
ReDim byteRead(objUPSPort.BytesToRead)
objUPSPort.Read(byteRead, 0, objUPSPort.BytesToRead)
strRecv = String.Empty
For i = 0 To byteRead.Length - 1
strRecv = strRecv & Chr(byteRead(i))
Next
If byteRead(38) = 48 Then
MsgBox("Power OK")
ElseIf byteRead(38) = 49 Then
MsgBox("Power Off")
Else
MsgBox("Unknown")
End If
strRet = strRecv
Return strRecv
Else
MsgBox("Error In ComPort Object")
Return String.Empty
End If
Catch ex As Exception
MsgBox("Exception In ComPort Object - " & ex.Message)
Return String.Empty
Finally
objUPSPort.Close()
End Try
End Function
I had few experiences in RS232 comm with USB, as nowadays laptops/pc they dont come with serial port no more. Serial ports usually emulated by USB, using [TTL-to-RS232 transistor, MAX like] some common supplier would use prolific as driver to emulate USB-to-RS232. First you need to know the data type, a simple string or binary.
SerialPorts is event driven, data coming thru the ports can trigger events. I assume to get UPS to send you status, first, you need to send command, as such [some pseudo];
objUPSPort.WriteLine("Command will be here" & vbCrLf)
There two ways to get the data:
Using data receive event driven :
Private Sub objUPSPort_DataReceived(sender As Object, e As IO.Ports.SerialDataReceivedEventArgs) Handles objUPSPort.DataReceived
'call ReceiveData()
End Sub
Create a pooling thread to read data periodically
Private Sub threadUPSReceive()
Do
data = objUPSPort.ReadLine() 'for string
'process the data here or call ReceiveData()
Loop
End Sub
If data stream to be read is binary (similar like yours):
Private Function ReceiveData()
Dim bRead As Integer
Dim returnStr As String = vbEmpty
bRead = objUPSPort.BytesToRead 'Number of Bytes to read
Dim cData(bRead - 1) As Byte
For Each b As Byte In cData
returnStr += Chr(b) 'put data stream in readable ascii
Next
Return returnStr
End Sub
One more thing, make sure the baudrate/stopbit/databit is set correctly.
Hope this help.
As a hobby I'm interesting in programming an Ethernet-connected LED sign to scroll messages across a screen. But I'm having trouble making a UDP sender in VB.NET (I am using 2008 currently).
Now the sign is nice enough to have a specifications sheet on programming for it.
But an example of a line to send to it (page 3):
<0x01>Z30<0x02>AA<0x06><0x1B>0b<0x1C>1<0x1A>1This message will show up on the screen<0x04>
With codes such as <0x01> representing the hex character.
Now, to send this to the sign I need to use UDP. However, the examples I have all encode the message as ASCII before sending, like this one (from UDP: Client sends packets to, and receives packets from, a server):
Imports System.Threading
Imports System.Net.Sockets
Imports System.IO
Imports System.Net
Public Class MainClass
Shared Dim client As UdpClient
Shared Dim receivePoint As IPEndPoint
Public Shared Sub Main()
receivePoint = New IPEndPoint(New IPAddress(0), 0)
client = New UdpClient(8888)
Dim thread As Thread = New Thread(New ThreadStart(AddressOf WaitForPackets))
thread.Start()
Dim packet As String = "client"
Console.WriteLine("Sending packet containing: ")
'
' Note the following line below, would appear to be my problem.
'
Dim data As Byte() = System.Text.Encoding.ASCII.GetBytes(packet)
client.Send(data, data.Length, "localhost", 5000)
Console.WriteLine("Packet sent")
End Sub
Shared Public Sub WaitForPackets()
While True
Dim data As Byte() = client.Receive(receivePoint)
Console.WriteLine("Packet received:" & _
vbCrLf & "Length: " & data.Length & vbCrLf & _
System.Text.Encoding.ASCII.GetString(data))
End While
End Sub ' WaitForPackets
End Class
To output a hexcode in VB.NET, I think the syntax may possibly be &H1A - to send what the specifications would define as <0x1A>.
Could I modify that code, to correctly send a correctly formated packet to this sign?
The answers from Grant (after sending a packet with hex in it), Hamish Smith (using a function to get hex values), and Hafthor (hardcoded chr() message into example) when attempted all did not work. So I'll research to see what else could go wrong. In theory, if this string is sent successfully, I should have a message containing "OK" back, which will help to know when it works.
I have tried and am now able to monitor the packets going through. A working packet example is this (in raw hex): http://www.brettjamesonline.com/misc/forums/other/working.raw vs my version: http://www.brettjamesonline.com/misc/forums/other/failed.raw. The difference is my hex codes are still not encoded correctly, seen in this side-by-side image: http://www.brettjamesonline.com/misc/forums/other/snapshotcoding.png.
I have used this code to generate the packet and send it:
container = &H1 & "Z" & &H30 & &H2 & "temp.nrg" & &H1C & "1Something" & &H4
' This did not appear to work neither
'container = Chr(&H1) & "Z" & Chr(&H30) & Chr(&H2) & Chr(&H1C) & "1Something" & Chr(&H4)
'<0x01>Z00<0x02>FILENAME<0x1C>1Test to display<0x04> <- the "official" spec to send
Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes(container)
(Full snippet: http://pastebin.com/f44417743.)
You could put together a quickie decoder like this one:
Function HexCodeToHexChar(ByVal m as System.Text.RegularExpressions.Match) As String
Return Chr(Integer.Parse(m.Value.Substring("<0x".Length, 2), _
Globalization.NumberStyles.HexNumber))
End Function
then use this to transform:
Dim r As New System.Text.RegularExpressions.Regex("<0x[0-9a-fA-F]{2}>")
Dim s As String = r.Replace("abc<0x44>efg", AddressOf HexCodeToHexChar)
' s should now be "abcDefg"
you could also make an encoder function that undoes this decoding (although a little more complicated)
Function HexCharToHexCode(ByVal m As Match) As String
If m.Value.StartsWith("<0x") And m.Value.EndsWith(">") And m.Value.Length = "<0x??>".Length Then
Return "<0<0x78>" + m.Value.Substring("<0x".Length)
ElseIf Asc(m.Value) >= 0 And Asc(m.Value) <= &HFF Then
Return "<0x" + Right("0" + Hex(Asc(m.Value)), 2) + ">"
Else
Throw New ArgumentException("Non-SBCS ANSI characters not supported")
End If
End Function
and use this to transform:
Dim r As New Regex("[^ -~]|<0x[0-9a-fA-F]{2}>")
Dim s As String = r.Replace("abc"+chr(4)+"efg", AddressOf HexCharToHexCode)
' s should now be "abc<0x04>efg"
or you could just build the string with the special characters in it to begin with like this:
Dim packet As String = Chr(&H01) + "Z30" + Chr(&H02) + "AA" + Chr(&H06) + _
Chr(&H1B) + "0b" + Chr(&H1C) + "1" + Chr(&H1A) + _
"1This message will show up on the screen" + Chr(&H04)
for sending a UDP packet, the following should suffice:
Dim i As New IPEndPoint(IPAddress.Parse("192.168.0.5"), 3001) ''//Target IP:port
Dim u As New UdpClient()
Dim b As Byte() = Encoding.UTF8.GetBytes(s) ''//Where s is the decoded string
u.Send(b, b.Length, i)
This might help. At my company we have to communicate with our hardware using sort of a combination of ascii and hex.
I use this function to hexify ip addresses before sending them to the hardware
Public Function HexFromIP(ByVal sIP As String)
Dim aIP As String()
Dim sHexCode As String = ""
aIP = sIP.Split(".")
For Each IPOct As String In aIP
sHexCode += Hex(Val(IPOct)).PadLeft(2, "0")
Next
Return sHexCode
End Function
And occationally I use hexSomething = Hex(Val(number)).PadLeft(2,"0") as well.
I can give you the source for the whole program too, though it's designed to talk to different hardware.
EDIT:
Are you trying to send packets in hex, or get packets in hex?
The UDP client sends an array of bytes.
You could use a memory stream and write bytes to an array.
Public Class MainClass
Shared client As UdpClient
Shared receivePoint As IPEndPoint
Public Shared Sub Main()
receivePoint = New IPEndPoint(New IPAddress(0), 0)
client = New UdpClient(8888)
Dim thread As Thread = New Thread(New ThreadStart(AddressOf WaitForPackets))
thread.Start()
Dim packet As Packet = New Packet("client")
Console.WriteLine("Sending packet containing: ")
Dim data As Byte() = packet.Data
client.Send(data, data.Length, "localhost", 5000)
Console.WriteLine("Packet sent")
End Sub
Public Shared Sub WaitForPackets()
While True
Dim data As Byte() = client.Receive(receivePoint)
Console.WriteLine("Packet received:" & _
vbCrLf & "Length: " & data.Length & vbCrLf & _
System.Text.Encoding.ASCII.GetString(data))
End While
End Sub ' WaitForPackets
End Class
Public Class Packet
Private _message As String
Public Sub New(ByVal message As String)
_message = message
End Sub
Public Function Data() As Byte()
Dim ret(13 + _message.Length) As Byte
Dim ms As New MemoryStream(ret, True)
ms.WriteByte(&H1)
'<0x01>Z30<0x02>AA<0x06><0x1B>0b<0x1C>1<0x1A>1This message will show up on the screen<0x04>
ms.Write(System.Text.Encoding.ASCII.GetBytes("Z30"), 0, 3)
ms.WriteByte(&H2)
ms.Write(System.Text.Encoding.ASCII.GetBytes("AA"), 0, 2)
ms.WriteByte(&H6)
ms.Write(System.Text.Encoding.ASCII.GetBytes("0b"), 0, 2)
ms.WriteByte(&H1C)
ms.Write(System.Text.Encoding.ASCII.GetBytes("1"), 0, 1)
ms.WriteByte(&H1A)
ms.Write(System.Text.Encoding.ASCII.GetBytes(_message), 0, _message.Length)
ms.WriteByte(&H4)
ms.Close()
Data = ret
End Function
End Class
They posted libraries for a bunch of languages including Visual Basic (in the separate file). I tested the demos out with one of their signs and they work!
http://support.favotech.com