473,378 Members | 1,454 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,378 software developers and data experts.

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 2406
resolve = receive
Jul 22 '05 #2
* Martin Petzold <mp******@gmx.net> schriebt:


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

Perhaps try [comp.os.ms-windows.programmer.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.net> 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)cyberspace.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.net> 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.net> 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.net> 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.net> schriebt:


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

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

See the FAQ for some other possibilities & posting guidelines.

Aside from the fact that you're OT, you should use "sizeof(Byte)"
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
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...
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...
4
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
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...
1
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,...
13
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...
2
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...
4
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...
0
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...
4
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,...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.