473,322 Members | 1,538 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

sending <STX><ETX > charaters to RS232 port

Hi ,
i m trying to send a message packet to a RS232 port. I have created the
handle and set the parameters. Now the general format of the packet is
<STX>command<ETX><LRC>

I have also written the code to calculate <LRC>.

now i dont understand how to make the packet string. should i call
writefile with STX, command , ETX and LRC characters differently or in
a single string. can anyone give me the exact string for a command say
z42. should it be something like "\2z42\3\lrc". Plss help, thanks in
advance

Jan 19 '06 #1
2 12049
jy**********@gmail.com wrote:
i m trying to send a message packet to a RS232 port.
Which is simply impossible using only the means of the standard C++
language. Neither the language proper nor the library contains any
mechanisms to control hardware. You need to post your query to the
newsgroup that deals with your OS, most likely.
I have created the
handle and set the parameters. Now the general format of the packet is
<STX>command<ETX><LRC>

I have also written the code to calculate <LRC>.

now i dont understand how to make the packet string. should i call
writefile with STX, command , ETX and LRC characters differently or in
a single string. can anyone give me the exact string for a command say
z42. should it be something like "\2z42\3\lrc". Plss help, thanks in
advance


I am not sure what <STX> is (that's not defined in the language either),
but if it's a symbol with the value 1, then you may be better off using
three-digit octal notation: "\002z42\003". If this doesn't help, post
again to the forum that covers your OS. Whatever you think "\lrc" does,
we can't really help you. There is no such escape sequence in C++. The
accepted ones are \a \b \f \n \r \t \v \' \" \? \\. If your compiler
accepts it, there must be an extension to the language that allow that,
and you need to ask about it in the newsgroup that deals with your
compiler.

There is no such thing in C++ as "command say z42".

Read the FAQ, there are some suggestions where to post if your question
is OT here (and it is).

V
Jan 19 '06 #2
jy**********@gmail.com wrote:
Hi ,
i m trying to send a message packet to a RS232 port. I have created the
handle and set the parameters. Now the general format of the packet is
<STX>command<ETX><LRC>

I have also written the code to calculate <LRC>.

now i dont understand how to make the packet string. should i call
writefile with STX, command , ETX and LRC characters differently or in
a single string. can anyone give me the exact string for a command say
z42. should it be something like "\2z42\3\lrc". Plss help, thanks in
advance

Please don't use pseudo words like 'plss'.

Are you using a C style string, or a C++ string?

If the former, just assign the elements ( string[0] = STX; ...).

There are many ways of building a buffer, which have you considered?

--
Ian Collins.
Jan 19 '06 #3

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

Similar topics

4
by: David | last post by:
I'm wondering if python is capable of fairly precise timing and also sending data out the parallel port. For example ; making a 7.5 KHz square wave come out of one of the data pins on the...
9
by: MNQ | last post by:
Hi All I want to use my parallel port of my PC to control some external devices. I am writing a program in ANSI C using the PacificC compiler. What I need to know is how to access the parallel...
3
by: ... | last post by:
Hi I need to send a chr(255) to a serial port. When I send it, through comm.write (chr(255)) it sends a chr(63) ... in Hex, I write chr(&FF) and it actually sends chr(&3F) ... why does this...
2
by: johnfotl | last post by:
How can I get data from an RS232 port in VB6?
1
by: pkay044 | last post by:
Currently i am putting up an application software that will be able to read and send any kind of file through a usb, but i am stuck as regards to reading and sending the file, i can open the file but...
5
by: ilhanuludag | last post by:
hello everyone, I am a new member. For my project I have to send binary data (like 10001110) to the db9 rs232 port. I use visual c++ 6.0. I found some codes but they could not work properly. Can...
5
by: Canuno | last post by:
Hi, I'm trying to send a small string to a serial port rs232 located in com 4. the string is: "ST GA#ˇ" The Baud Rate is: 38400 Parity: None Data Bits: 8 Stops Bits: 1 Flow Control: None...
3
by: jeekesh | last post by:
Hi I am very new to java. I have made one application for inventory mgmt. I want some ready code to read data from barcode scanner or rs232 port. If any of have such code than please help me
0
by: Debasish Mandal | last post by:
I am trying to send SMS using sending AT commands to a GPRS mobile device in windows enviornment.I can send sms when i am sending commands using Hyper Terminal.but the problem is when i am Sending...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.