Page 1 of 1
Windows Programming with vb.net
Posted: Wed Aug 09, 2006 9:27 am
by sang@ibexpayroll.com
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?
Posted: Wed Aug 09, 2006 1:55 pm
by Jon
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)
Re: Windows Programming with vb.net
Posted: Wed Aug 09, 2006 2:25 pm
by Jeroen Vonk
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)
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()
BTW if you want to turn on the display (I believe that is "B" right?) you should also send the minutes after which the display should turn off, or use 0 minutes to just leave it on. (so you should send 254, "B", 0)
SDK Dispose
Posted: Thu Aug 10, 2006 2:37 pm
by sang@ibexpayroll.com
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
Re: SDK Dispose
Posted: Thu Aug 10, 2006 4:05 pm
by Jeroen Vonk
sang@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?
For some reason I really like this message

(but you are not the first who asks this, so I will remove it. I'll let you know when it's available for download.)
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.
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?
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.
Re: SDK Dispose
Posted: Fri Aug 11, 2006 3:04 pm
by sang@ibexpayroll.com
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?
When i use the ReadModuleType commad 0X42 is returned, regardless i am still getting this error.
Re: SDK Dispose
Posted: Sat Aug 12, 2006 8:55 am
by Jeroen Vonk
sang@ibexpayroll.com wrote:When i use the ReadModuleType commad 0X42 is returned, regardless i am still getting this error.
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.