TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Roi Florentino
NA
3
1.2k
Passing data from C# to ComPort2 (USb to RS232)
Jan 17 2018 4:05 AM
I have a card dispensing device in which I want to be triggered by a C# program.
The Card Dispensing Device has a command to trigger the card-out function.
Now when I checked the 42 is a hex and the H is just a hex determinator of some sort.
They gave me an exe which do the sending of data but I want to repliacte it and create my own.
In the exe that they gave when I press card out it shows a command like this one
-->[0x01] [0x42]
the first [] is for the device the second [] is the I think ascii hex of the command.
Here's the code I have so far
using
System.IO.Ports;
namespace
Card_Reader
{
public
partial
class
Form1 : Form
{
public
Form1()
{
InitializeComponent();
}
private
void
button1_Click(
object
sender, EventArgs e)
{
using
(SerialPort port =
new
SerialPort(
"COM2"
, 9600, Parity.None, 8))
{
byte
[] bytesToSend =
new
byte
[1] { 0x2A };
port.Open();
port.Write(bytesToSend, 0, 1);
}
}
I did not include all closing brackets.
Reply
Answers (
1
)
CrystalReport error??
inconsistent accessibility