José Perez
asked on
VB.Net Serial COM1 Port - how to send this text via Serial COM port?
Hi,
a client has a little serial port COM1 printer that get's locked every day at night (it works ok until night is come, maybe after 23:59hrs.)
As support people, we have a little program (57kb) that unlocks the printer, it is an old and ugly program writen in vc++ 6.0 (MFC).
The problem with this program is that is cryptinc for users, they will never understand how to use it, and we no longer have the source code to modify.
We have seen this little program send the following numbers to the printer to unlock it:
160 1 13 128 107 40 198 168 0 1 0 8 0 0 0 157 0 0 1 94
We think it may be a "byte" representation of a function that 'unlocks' the printer when it gets locked.
I can even also pay for the solution, if available through EE, we unlock this via an old program that a user will never understand so i need to add the unlock procedure to our current VB.Net app so it is easier for user to unlock them by them selves..
Note: When we turn the printer on, it sends the following numbers: 0 64
a client has a little serial port COM1 printer that get's locked every day at night (it works ok until night is come, maybe after 23:59hrs.)
As support people, we have a little program (57kb) that unlocks the printer, it is an old and ugly program writen in vc++ 6.0 (MFC).
The problem with this program is that is cryptinc for users, they will never understand how to use it, and we no longer have the source code to modify.
We have seen this little program send the following numbers to the printer to unlock it:
160 1 13 128 107 40 198 168 0 1 0 8 0 0 0 157 0 0 1 94
We think it may be a "byte" representation of a function that 'unlocks' the printer when it gets locked.
I can even also pay for the solution, if available through EE, we unlock this via an old program that a user will never understand so i need to add the unlock procedure to our current VB.Net app so it is easier for user to unlock them by them selves..
Note: When we turn the printer on, it sends the following numbers: 0 64
ASKER
Locked means we cannot print anymore until we unlock the printer via the old program I mention above.
PortMon displays "Error 2" so I installed a demo version (14 days) of "Serial Port Monitor app" (http://www.eltima.com/products/serial-port-monitor/) and it displayed the folloowing results...
I clicked the button that unlocks the printer... It displays the following information:
PortMon displays "Error 2" so I installed a demo version (14 days) of "Serial Port Monitor app" (http://www.eltima.com/products/serial-port-monitor/) and it displayed the folloowing results...
I clicked the button that unlocks the printer... It displays the following information:
Dump view
[15/12/2016 18:04:03] Written data (COM1)
a0 02 02 b2 83 00 bc 88 00 ..²ƒ.¼ˆ.
[15/12/2016 18:04:04] Read data (COM1)
a0 03 0d 7c 96 e4 9a a8 00 01 00 08 00 00 34 b9 ..|–䚨......4¹
00 00 a7 f7 ..§÷
Termnal View
..²ƒ.¼ˆ. .
|–䚨......4¹..§÷
You need to run portmon with administrative privileges.
The problem with this dump is: There is no information about the port settings..
The problem with this dump is: There is no information about the port settings..
ASKER
Full image attached...
serial_port_monitor.png
serial_port_monitor.png
Hi Jose;
See if this will unlock the printer when this message is sent to it through the VB .Net program
See if this will unlock the printer when this message is sent to it through the VB .Net program
Dim unlockPtr = New Byte() { &HA0, &H01, &H02, &HB2, &H83, &H00, &HBC, &H88, &H00 }
'' Where com1 is the serial port object to send the message to.
com1.Write(unlockPtr, 0, unlockPtr.Length)
ASKER
It displays a error message saying "com1 is not declared"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Did that help?
ASKER
Fernando, It works perfect!
Is there someway we can match "{&HA0, &H1, &H2, &HB2, &H83, &H0, &HBC, &H88, &H0}" with "160 1 13 128 107 40 198 168 0 1 0 8 0 0 0 157 0 0 1 94" so I can understand more how did you get the solution or how the program interpreted the Hex values?
Thanks.
Is there someway we can match "{&HA0, &H1, &H2, &HB2, &H83, &H0, &HBC, &H88, &H0}" with "160 1 13 128 107 40 198 168 0 1 0 8 0 0 0 157 0 0 1 94" so I can understand more how did you get the solution or how the program interpreted the Hex values?
Thanks.
Hi Jose;
According to your post [HERE] and a previous screen shot shows that this message, a0 02 02 b2 83 00 bc 88 00 as hexadecimal data, is being sent to the printer to unlock it. The other message, a0 03 0d 7c 96 e4 9a a8 00 01 00 08 00 00 34 b9 00 00 a7 f7 as hexadecimal data, seems to be the response for the unlock command from the printer back to your application. To understand what these messages mean you will need to look it up in the printers Users / Programmers manual because these messages are printer specific.
To your question, "Is there someway we can match {&HA0, &H1, ..., &H88, &H0}", prefixing with &H means that the characters that follow it are hexadecimal value and can be converted to decimal value using its positional value as shown [HERE : CONVERTING HEXADECIMAL TO DECIMAL] or you can lookup each value by going down the hex column in an Extended ASCII table and when you find the hex value look at the decimal value column.
I hope that helps.
According to your post [HERE] and a previous screen shot shows that this message, a0 02 02 b2 83 00 bc 88 00 as hexadecimal data, is being sent to the printer to unlock it. The other message, a0 03 0d 7c 96 e4 9a a8 00 01 00 08 00 00 34 b9 00 00 a7 f7 as hexadecimal data, seems to be the response for the unlock command from the printer back to your application. To understand what these messages mean you will need to look it up in the printers Users / Programmers manual because these messages are printer specific.
To your question, "Is there someway we can match {&HA0, &H1, ..., &H88, &H0}", prefixing with &H means that the characters that follow it are hexadecimal value and can be converted to decimal value using its positional value as shown [HERE : CONVERTING HEXADECIMAL TO DECIMAL] or you can lookup each value by going down the hex column in an Extended ASCII table and when you find the hex value look at the decimal value column.
I hope that helps.
ASKER
Great! Thanks a lot, really happy with the solution.
ASKER
Excellent answer. Good expert.
Not a problem Jose, glad I was able to help.
Cause signaling on different lines may also of importance. Post the result.
Also what printer? And what does locked mean?