Windows Programming with vb.net

LK/ELK/VK/PK/OK/MX/GLK/EGLK/GVK/GLT Series

Moderators: Henry, Mods

Post Reply
sang@ibexpayroll.com
LCD?
Posts: 4
Joined: Tue Aug 08, 2006 3:09 pm

Windows Programming with vb.net

Post 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?

Jon
Matrix Orbital
Matrix Orbital
Posts: 231
Joined: Mon Oct 24, 2005 10:38 am
Location: Calgary, AB, Canada
Contact:

Post 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)

Jeroen Vonk
LCD Guru
Posts: 55
Joined: Tue Apr 12, 2005 2:31 am

Re: Windows Programming with vb.net

Post by Jeroen Vonk »

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
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)

sang@ibexpayroll.com
LCD?
Posts: 4
Joined: Tue Aug 08, 2006 3:09 pm

SDK Dispose

Post 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

Jeroen Vonk
LCD Guru
Posts: 55
Joined: Tue Apr 12, 2005 2:31 am

Re: SDK Dispose

Post 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.

sang@ibexpayroll.com
LCD?
Posts: 4
Joined: Tue Aug 08, 2006 3:09 pm

Re: SDK Dispose

Post 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.

Jeroen Vonk
LCD Guru
Posts: 55
Joined: Tue Apr 12, 2005 2:31 am

Re: SDK Dispose

Post 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.

Post Reply