473,756 Members | 4,165 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem sending code via rs232

Hi,
i always resolve an "arrow up" instead an "A" when i do this (snipped!):

BYTE Byte;

Byte = 0x41;
PortWrite((BYTE )(&Byte));

BOOL PortWrite (BYTE Byte)
{
WriteFile (hPort, &Byte, sizeof (&Byte), NULL, NULL);
return TRUE;
}

what is the problem?

thx martin
Jul 22 '05 #1
8 2442
resolve = receive
Jul 22 '05 #2
* Martin Petzold <mp******@gmx.n et> schriebt:


This is off-topic in [comp.lang.c++].

Perhaps try [comp.os.ms-windows.program mer.win32]?

See the FAQ for some other possibilities & posting guidelines.

--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 22 '05 #3
Martin Petzold <mp******@gmx.n et> spoke thus:
i always resolve an "arrow up" instead an "A" when i do this (snipped!):


What Mr. Steinbach said, and also never multi-post again.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cybers pace.org | don't, I need to know. Flames welcome.
Jul 22 '05 #4
Martin Petzold wrote:

I always resolve an "arrow up" instead an "A" when i do this (snipped!):

BYTE Byte;

Byte = 0x41;
PortWrite((BYTE )(&Byte));

BOOL PortWrite (BYTE Byte) {
WriteFile (hPort, &Byte, sizeof (&Byte), NULL, NULL);
return TRUE;
}

what is the problem?


You don't know what you are doing.

It appears that you are attempting to write the address of a BYTE
which contains the value 0x41.

Jul 22 '05 #5
On Mon, 12 Apr 2004 18:14:56 GMT in comp.lang.c++, al***@start.no (Alf
P. Steinbach) wrote,
* Martin Petzold <mp******@gmx.n et> schriebt:


This is off-topic in [comp.lang.c++].


No it's not. The difference between a char, and the address of a char,
and the address of an array of chars, is not to be ignored in any
standard implementation of C++.

Jul 22 '05 #6
"Martin Petzold" <mp******@gmx.n et> wrote in message
news:c5******** **@newsreader2. netcologne.de.. .
Hi,
i always resolve an "arrow up" instead an "A" when i do this (snipped!):

BYTE Byte;

Byte = 0x41;
PortWrite((BYTE )(&Byte));

BOOL PortWrite (BYTE Byte)
{
WriteFile (hPort, &Byte, sizeof (&Byte), NULL, NULL);
return TRUE;
}

what is the problem?

thx martin


Assuming that WriteFile requires an address as the second parameter, and a
size as the third parameter, you are writing the size of an address rather
than the size of a byte.

Perhaps this will fix it:
WriteFile (hPort, &Byte, sizeof (Byte), NULL, NULL);

Jul 22 '05 #7

"Martin Petzold" <mp******@gmx.n et> wrote in message
news:c5******** **@newsreader2. netcologne.de.. .
Hi,
i always resolve an "arrow up" instead an "A" when i do this (snipped!):

BYTE Byte;

Byte = 0x41;
PortWrite((BYTE )(&Byte));
PortWrite takes a BYTE, not a pointer to a BYTE, so just pass it Byte, not
the address of Byte.

BOOL PortWrite (BYTE Byte)
{
WriteFile (hPort, &Byte, sizeof (&Byte), NULL, NULL);
If you're intending to write the value stored in Byte, then the size you
probably want is sizeof(BYTE), not the size of the address of the variable.
return TRUE;
}

what is the problem?

thx martin

Perhaps you want this?

PortWrite(Byte) ;
....
BOOL PortWrite( BYTE Byte )
{
WriteFile( hPort, &Byte, sizeof(BYTE), NULL, NULL );
....
}

?

-Howard
Jul 22 '05 #8
al***@start.no (Alf P. Steinbach) wrote in message news:<40******* *********@news. individual.net> ...
* Martin Petzold <mp******@gmx.n et> schriebt:


This is off-topic in [comp.lang.c++].

Perhaps try [comp.os.ms-windows.program mer.win32]?

See the FAQ for some other possibilities & posting guidelines.

Aside from the fact that you're OT, you should use "sizeof(Byt e)"
instead of "sizeof(&Byte)" .
Jul 22 '05 #9

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

Similar topics

1
7819
by: Dan | last post by:
I wnat to see in browser an status from an device connected on rs232 port The java class for read from serial port is: //Serial.java import java.io.*; import java.util.*; import java.lang.*; import javax.comm.*;
13
11035
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 creates a "normal" comm port (like COM3). There is a C++ program that has no problem talking to the equipment, but two Python programs have trouble. One is a big, scary, controller program, and the other, since that is the one I'm having trouble...
4
407
by: Martin Petzold | last post by:
Hi, i always receive an "arrow up" instead an "A" when i do this (snipped!): BYTE Byte; Byte = 0x41; PortWrite((BYTE)(&Byte)); BOOL PortWrite (BYTE Byte) {
8
2058
by: Terry Olsen | last post by:
I'm trying to use the RS232 class that was in the Platform SDK (i think). Has anyone else used this with events successfully? Here's what i've got: ====================== Public WithEvents bbsPort As Rs232 = New Rs232 With bbsPort .BaudRate = baud .DataBit = dataBits .Parity = parity .Port = comPort
1
1748
by: Tony Papadimitriou | last post by:
Hi all, I've written an app using RS232.VB (by Keith Langer 2/5/02 -- Modified to handle overlapped IO and provide asynchronous read/write) and the executable works as expected under XP Pro but, the RS232 portion of the app doesn't work under Win98SE. Any ideas? TIA
13
6862
by: jay.dow | last post by:
I want to write to the pins of an RS232 without using the serial protocol. The use would be every pin could act to complete a circuit in customized hardware. I could use python to communicate serially to a BASIC stamp or a Javelin stamp and then use the stamp to set however many pins as 0's or 1's but should it be that hard to do with python. I've looked through how python does serial with the "serial" module but it just uses Java's...
2
12126
by: jyotish.bora | last post by:
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
4
1711
by: j.aloussi | last post by:
Hello, I am developing a serial-communication application for a pocket-PC and a PC. I am trying to make a serial-port connection via Bluetooth. All goes well: Bluetooth connection and COM ports starting at both sides. The problem is by sending Data via the COM port. For example whenn I send: "Foo Data to send". I receive at the other
0
974
by: zektor | last post by:
Hi there, I have an application that have 1 backgroundworker doing operation in hw through rs232 (like a pooling constantly). In my UI thread I have do operations also on that resource (rs232 resource). The problem: When I click a button to send data over th rs232 and the worker is doing Some operation (backWorker.IsBusy == true) I send a cancelAsync to the worker, but I have to wait to perform operations. I try to sleep the current UI...
4
2745
by: Xavier | last post by:
Hi, I try to access to a Bluetooth GPS data-logger with Python. I use pySerial. Sending and receiving little messages (~100 char) works fine. However, when I ask the GPS to dump the trails, it returns some Mbytes and here is the problem : in the stream of bytes, I randomly losts chunks of ~100bytes.
0
9487
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9297
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10069
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9904
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9735
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7285
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6556
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2697
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.