473,473 Members | 2,015 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Write commands to the COM port

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?
Sep 21 '06 #1
5 5862
Ivovh wrote:
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.

Sep 21 '06 #2
TY this was the solution :)

"Chris Dunaway" <du******@gmail.comschreef in bericht
news:11**********************@h48g2000cwc.googlegr oups.com...
Ivovh wrote:
>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.

Sep 21 '06 #3
Chris Dunaway wrote:
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
Sep 21 '06 #4
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.
Sep 21 '06 #5

Andrew Morton wrote:
Chris Dunaway wrote:
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.
Thanks Gramps! :)

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

Sep 22 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: A | last post by:
I need to send "AT" Commands to a GSM Modem that is connected to my local machine vi a USB port. How is this done? Is there an interface in .NET that allows communicating to the USB Port? Sample...
13
by: Bob Greschke | last post by:
We have some equipment that communicates at 57600 baud RS232. The path from the PC is USB to a Phillips USB hub, then off of that a TUSB3410 USB/Serial converter. The driver for the 3410 chip...
18
by: jas | last post by:
Hi, I would like to start a new process and be able to read/write from/to it. I have tried things like... import subprocess as sp p = sp.Popen("cmd.exe", stdout=sp.PIPE)...
4
by: Tom Van Ginneken | last post by:
Hi, I need to write binary data to a serial port. I am using this function: #include <unistd.h> ssize_t write(int fd, const void *buf, size_t count); I am able to write a alpha-numeric...
3
by: collinm | last post by:
hi i send a command to a led display, the led display is suppose to return me some character i write a string on a serial port void ledDisplayExist() { char msg={'\0', '\0', '\0', '\0',...
1
by: Jonas Hei | last post by:
I need to develop support for communications using modems (AT compatible modems) in my application? Where do I start? Would you recommend using TAPI? Or would it be a better idea to directly...
3
by: Matthew Warren | last post by:
I have the following piece of code, taken from a bigger module, that even as I was writing I _knew_ there were better ways of doing it, using a parser or somesuch at least, but learning how wasn't...
10
by: suvarna | last post by:
hi i am having problem in firing commands to the hp printer through vb code. i used hp printer commands in my code but when the commands are fired it gives error "failed to print the doccument"....
0
by: Astan Chee | last post by:
Hi, Im trying to implement the logic from http://www.hypothetic.org/docs/msn/general/http_connections.php to a simple python code using urllib2 and some parts of urllib. Im behind a http proxy...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.