I'm trying to send numbers over the serial port as bytes, not strings.
What I mean is if I want to send a 255, that should be 1 byte, not a 2
followed by a 5 and a 5. I'm trying to convert a borland c++ app.
This is what the c++ app does
int8B = 255;
WriteFile(seria lPort,&int8B,1, &bytesWritten,N ULL);
int8 = gainSlider->Position;
WriteFile(seria lPort,&int8,1,& bytesWritten,NU LL);
int8 = offsetSlider->Position;
WriteFile(seria lPort,&int8,1,& bytesWritten,NU LL);
int8 = exposureSlider->Position;
WriteFile(seria lPort,&int8,1,& bytesWritten,NU LL);
Here is what I'm doing that does not work
int x = 255;
sp.WriteLine(St ring.Format("{0 }", x));
sp.WriteLine(St ring.Format("{0 }", trackBar_Gain.V alue));
sp.WriteLine(St ring.Format("{0 }", trackBar_Offset .Value));
sp.WriteLine(St ring.Format("{0 }", trackBar_Exposu re.Value));
How do I send the 255? I can't do sp.WriteLine(25 5) since it wants a
string.
any help will be greatly appreciated.
Ringo 1 4381
"Ringo" <ri*********@gm ail.comwrote in message
news:11******** **************@ a75g2000cwd.goo glegroups.com.. .
I'm trying to send numbers over the serial port as bytes, not strings.
What I mean is if I want to send a 255, that should be 1 byte, not a 2
followed by a 5 and a 5. I'm trying to convert a borland c++ app.
This is what the c++ app does
int8B = 255;
WriteFile(seria lPort,&int8B,1, &bytesWritten,N ULL);
int8 = gainSlider->Position;
WriteFile(seria lPort,&int8,1,& bytesWritten,NU LL);
int8 = offsetSlider->Position;
WriteFile(seria lPort,&int8,1,& bytesWritten,NU LL);
int8 = exposureSlider->Position;
WriteFile(seria lPort,&int8,1,& bytesWritten,NU LL);
Here is what I'm doing that does not work
int x = 255;
sp.WriteLine(St ring.Format("{0 }", x));
sp.WriteLine(St ring.Format("{0 }", trackBar_Gain.V alue));
sp.WriteLine(St ring.Format("{0 }", trackBar_Offset .Value));
sp.WriteLine(St ring.Format("{0 }", trackBar_Exposu re.Value));
How do I send the 255? I can't do sp.WriteLine(25 5) since it wants a
string.
any help will be greatly appreciated.
Isn't there a .Write method that accepts a byte array? That will avoid the
conversion to ASCII text.
Ringo This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Timothy Smith |
last post by:
hello people.
i've been trying to send an 8 byte string to my parallel port under
freebsd. the purpose is it to control a relay board.
the board simply responds to the output byte coming from the port. eg.
00000001 will set pin 1 high and flick the relay open.
todate i've attempted this with merely open() on /dev/ppi0 and numpy for
the byte array, but i just can't seem to get it working.
i know the parallel port works and i know the...
|
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 happen, and how can I send it
right ?
I'm using vb.net 2005 express with framework 2.0
Thanks for an answear ...
|
by: cvschie |
last post by:
Hi,
I have a LED Sign with standard software to control messages (via
serial port). Because the limitations of the software I want my own
VB.net program.
With a serial analyzer program, I see all the data that the standard
program is sending to de LED sign.
With my ownprogram I send the same, and it works fine... except:
If I send a string to the LED Sign with a length of upto 16 chars it
works fine, but if the lengthe is 17 chars or...
|
by: cmdolcet69 |
last post by:
How can i add a 5ms delay between bytes i send over to a controller?
I have to send 6 bytes in total however in between each byte i need to
have a 5ms delay.
|
by: Rich |
last post by:
Hello,
I am working on a python library for sending and receiving data from a Subaru's ECU (the fuel injection computer) via the OBD-II port and an OBD to USB cable, with the Subaru Select Monitor protocol. There are a few open source programs that do this already (http://romraider.com/ , http://jdash.sourceforge.net/ , http://tari.co.za/downloads/software/source/ ), but they are written in Java or C++. I have never done anything with serial...
| |
by: Gabriel Genellina |
last post by:
En Fri, 02 May 2008 16:50:46 -0300, Rich <richietommy@yahoo.comescribió:
No, chr works as it should. The same thing can be written as
ser.write("\x80\x10\xF0\x01\xBF\x40")
Are you sure you're talking to the right device, /dev/ttyUSB0? Are the
comm parameters correct?
(BTW, if you get more than a single character per loop, the print
statement will fail - try with ser.read(1))
|
by: Charles Crawford |
last post by:
Hi,
This apparently is a common problem and I've yet to read a solution that actually works for my specific situation.
I have a Zebra RW220 printer that I connect to via Bluetooth connection mapped to a serial port. The application I'm writing runs on a Windows Mobile 5 device, so there's no built in printer support and I have to use a serial port.
When I try to write the zpl code to the serial port, the printer simply prints the code...
|
by: =?Utf-8?B?Q2hhcmxpZQ==?= |
last post by:
Hi,
This apparently is a common problem and I've yet to read a solution that
actually works for my specific situation.
I have a Zebra RW220 printer that I connect to via Bluetooth connection
mapped to a serial port. The application I'm writing runs on a Windows Mobile
5 device, so there's no built in printer support and I have to use a serial
port.
|
by: ajorge |
last post by:
Good Morning!
I'm trying to send a few bytes through my serial port into a remote system, but i'm having a problem... Suposing that i'm trying to send the array of bytes:
68, 00, 00, 68, 00, 00, 00, 00, 80, 00, 01, 81, 00, 16
How to define this array?
Like this?
|
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...
|
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,...
| |
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...
|
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...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
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 we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |