Write commands to the COM port

  • Thread starter Thread starter Ivovh
  • Start date Start date
I

Ivovh

Hi,

I am writing a application that should be able send commands to a device
using the COM port.

I have tested the commands with hyper terminal and there they work. For
Example I press: Escape then shift-x then shift-j and the device does what
its suppose to do.

No I made a little programma that connects to the comport. I use
comport.Write() to send commands but I have no idea how I should send the
escape and the shift to the comport. And I what format I should send
command hex/ascii??

Anybody got some suggestions?
 
Ivovh said:
Hi,

I am writing a application that should be able send commands to a device
using the COM port.

I have tested the commands with hyper terminal and there they work. For
Example I press: Escape then shift-x then shift-j and the device does what
its suppose to do.

No I made a little programma that connects to the comport. I use
comport.Write() to send commands but I have no idea how I should send the
escape and the shift to the comport. And I what format I should send
command hex/ascii??

Anybody got some suggestions?

Escape should be Chr$(26) and shift-x and shift-j are just capital X
and capital J. You could construct a string like this:

Dim commandString As String = Chr$(26) & "XJ"

and try sending that string.
 
TY this was the solution :)

Chris Dunaway said:
Escape should be Chr$(26) and shift-x and shift-j are just capital X
and capital J. You could construct a string like this:

Dim commandString As String = Chr$(26) & "XJ"

and try sending that string.
 
Chris said:
Escape should be Chr$(26)

Er, no... it Chr$(27), aka ctrl-open-square-bracket. Chr$(0),
Chr$(1)...Chr$(26) are ctrl-@, ctrl-A...ctrl-Z.

I don't know, young people these days - you'd think they'd never controlled
an FX-80 by typing escape sequences on a keyboard :-)

Andrew
 
Hi,

If HyperTerminal worked, then you can use simple Strings (ASCII). For an
example, try the VS2005 Terminal example from my homepage.

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
 
Andrew said:
Er, no... it Chr$(27), aka ctrl-open-square-bracket. Chr$(0),
Chr$(1)...Chr$(26) are ctrl-@, ctrl-A...ctrl-Z.

I don't know, young people these days - you'd think they'd never controlled
an FX-80 by typing escape sequences on a keyboard :-)

Andrew.

Thanks Gramps! :)

I must be getting old, don't know why I forgot that!
 
Back
Top