1 Replies - 7401 Views - Last Post: 11 March 2009 - 11:27 PM Rate Topic: -----

#1 Cerebro  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 11-March 09

How to send command to serial ports in C++

Post icon  Posted 11 March 2009 - 06:08 PM


I'm really new to C++. I'd like to know how to send command to serial ports.
Im connecting to a uniwell POS machine and I dont know what commands I'll be using. They gave me this serial communication protocol manual with this format.

1.4 Clear All Request

It is always safest to clear all existing report requests before you request the days reports. This is done by sending the following request.


how do you send commands like that to a serial port? I know it would be using a WriteFile command but my concern is the format of the command that I'll be using.. coz I havent received any reply from the POS machine I'm trying to connect.

thank you.

Is This A Good Question/Topic? 0
  • +

Replies To: How to send command to serial ports in C++

#2 horace  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 612
  • View blog
  • Posts: 3,194
  • Joined: 25-October 06

Re: How to send command to serial ports in C++

Posted 11 March 2009 - 11:27 PM

have a look at

have you tried connecting to the POS machine using a terminal emulator program such as hyperterm. You need to set the PC baud raete, number of data bits, parity and number of stop bits to match the POS machine. If you don't know the baud rate try 9600 baud, 8 data bits, no parity one stop bit. If you see garbage on the screen the baud rate is probably wrong - try changing it until it works. If nothing appears on the screen the wiring could be wrong, e.g. do you need to connect the hardware handshaking lines?

for details of control characters such as SOH, STX ,etc see

This post has been edited by horace: 11 March 2009 - 11:29 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1