I'm trying to communicate with a MX 610 usb unit, using a vb.net application and using the RS232 communication class from microsoft http://www.microsoft.com/downloads/deta ... layLang=en
i seem to be able to connect, and write characters to the unit, but when i send a command i seem to just get the characters show up instead
comPort.Open(nudComPort.Value, 19200, 8, Rs232.DataParity.Parity_None, Rs232.DataStopBit.StopBit_1, 4096)
comPort.Write(Chr(254) + "B")
Does anyone have any suggestions i could try to make this work?
Windows Programming with vb.net
-
- LCD?
- Posts: 4
- Joined: Tue Aug 08, 2006 3:09 pm
-
- Matrix Orbital
- Posts: 231
- Joined: Mon Oct 24, 2005 10:38 am
- Location: Calgary, AB, Canada
- Contact:
HI Sang,
The problem is that you are sending a character instead of a raw byte.
Here is an example of working code:
Dim comPort As System.IO.Ports.SerialPort
Dim portName As String = "COM4"
Dim baudRate As Integer = 19200
Dim bArray() As Byte = {254, "F"}
comPort = New System.IO.Ports.SerialPort(portName, baudRate, IO.Ports.Parity.None, 8, IO.Ports.StopBits.One)
comPort.Write(bArray, 0, bArray.Length)
The problem is that you are sending a character instead of a raw byte.
Here is an example of working code:
Dim comPort As System.IO.Ports.SerialPort
Dim portName As String = "COM4"
Dim baudRate As Integer = 19200
Dim bArray() As Byte = {254, "F"}
comPort = New System.IO.Ports.SerialPort(portName, baudRate, IO.Ports.Parity.None, 8, IO.Ports.StopBits.One)
comPort.Write(bArray, 0, bArray.Length)
-
- LCD Guru
- Posts: 55
- Joined: Tue Apr 12, 2005 2:31 am
Re: Windows Programming with vb.net
If you are using VB.Net 2005 you can better use the new SerialPort Class which is included in .NET Framework 2.0. If you an older version you should consider using the free Visual Basic 2005 Express Edition. (and it even includes SQL 2005 Express and MSDN Express edition)sang@ibexpayroll.com wrote:I'm trying to communicate with a MX 610 usb unit, using a vb.net application and using the RS232 communication class from microsoft http://www.microsoft.com/downloads/deta ... layLang=en
Another possibility is to use my MatrixOrbital SDK, it could save you a lot of time. To turn the display off, this is all you have to do:
Code: Select all
Dim display As MatrixOrbital.TextDisplay = New MatrixOrbital.TextDisplay()
display.Open("COM4")
display.DisplayOff()
-
- LCD?
- Posts: 4
- Joined: Tue Aug 08, 2006 3:09 pm
SDK Dispose
Thanks for the replies, I am using the SDK (which i think needs a forum sticky/pin cause it wasn't obvious one was available), it works very well but i have two questions about it.
1) when i close the application i use the dispose fuction which also seems to display a message on the unit "MatrixOrbital SDK (c) ...", is it possible to change or eliminate this message?
2)Again i am using the MX610 unit, which gets reported as not being supported when i use the open function in the sdk, all the functions work just fine, so i'm just kind of ingoring this error, but i was wondering if you are aware of any possible problems i may have with this.
Thanks again for the prompt replies.
Sang
1) when i close the application i use the dispose fuction which also seems to display a message on the unit "MatrixOrbital SDK (c) ...", is it possible to change or eliminate this message?
2)Again i am using the MX610 unit, which gets reported as not being supported when i use the open function in the sdk, all the functions work just fine, so i'm just kind of ingoring this error, but i was wondering if you are aware of any possible problems i may have with this.
Thanks again for the prompt replies.
Sang
-
- LCD Guru
- Posts: 55
- Joined: Tue Apr 12, 2005 2:31 am
Re: SDK Dispose
For some reason I really like this messagesang@ibexpayroll.com wrote:Thanks for the replies, I am using the SDK (which i think needs a forum sticky/pin cause it wasn't obvious one was available), it works very well but i have two questions about it.
1) when i close the application i use the dispose fuction which also seems to display a message on the unit "MatrixOrbital SDK (c) ...", is it possible to change or eliminate this message?

The SDK should support the MX610, correct me if I'm wrong but I believe it is a PK202-24-USB right? I have a PK202-24-USB rev 1.6 which returns 0x42 as the display type and it works fine. Could you confirm that your display returns 0x42 as the display type, if not, could you please tell me your display type?sang@ibexpayroll.com wrote:2)Again i am using the MX610 unit, which gets reported as not being supported when i use the open function in the sdk, all the functions work just fine, so i'm just kind of ingoring this error, but i was wondering if you are aware of any possible problems i may have with this.
It is also possible to add support for your display type by yourself. Plesae check the readme.txt in the "Examples\Misc\Custom Configuration File" directory. It explains how to add support for your display type if it is not supported.
Hope this helps, if not, please feel free to ask.
-
- LCD?
- Posts: 4
- Joined: Tue Aug 08, 2006 3:09 pm
Re: SDK Dispose
When i use the ReadModuleType commad 0X42 is returned, regardless i am still getting this error.The SDK should support the MX610, correct me if I'm wrong but I believe it is a PK202-24-USB right? I have a PK202-24-USB rev 1.6 which returns 0x42 as the display type and it works fine. Could you confirm that your display returns 0x42 as the display type, if not, could you please tell me your display type?
-
- LCD Guru
- Posts: 55
- Joined: Tue Apr 12, 2005 2:31 am
Re: SDK Dispose
Could you try this debug version, it will create a log file (MatrixOrbitalSDK.log) and send this file to me? Could you also include an example of your VB.Net source which gives the error? Although the error is not really a problem, it should detect the display type so all functions and features of the module can be used properly.sang@ibexpayroll.com wrote:When i use the ReadModuleType commad 0X42 is returned, regardless i am still getting this error.