Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

What code to use in C# for sending data in bytes through serial port?

Status
Not open for further replies.

yasin

Newbie level 4
Joined
Sep 8, 2006
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,329
Hi,
If I want sending data through serial port, when data type was string; I will use from this code in c#: port. Write (string name)
But, if data type was byte, what code should I use in c# language?
Please guide me?
Best Regards
 

Re: one question?

You can still use the Write function. There are three overloaded Write functions. For writing bytes to serial port, you have to declare an array for storing the bytes you want to write. For example:

serialPort.Write(writeData, 0, 1);

where writeData is an array in byte, the second argument indicates from which element of the array you want to start with, the last argumebt indicates how many bytes to write.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top