15,899,935 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 11780461 (Top 19 by date)
Member 11780461
10-Jul-15 15:09pm
View
Alright, will do. Before I let you go, would it be just as easy to have the code open putty and send the keys and control characters?
Member 11780461
10-Jul-15 14:55pm
View
I have done that will all the settings I can see in the properties menu but where can I see the code for hyperterminal to compare it to mine?
Member 11780461
10-Jul-15 14:29pm
View
Yes I am using serial to usb adapter/cable. It has a usb on one end and a male serial face on the other which I then hook up to a null serial cable which then connects to the device (automated storage shelving unit). When I use hyperterminal or putty, I simply type ctrl B (STX control) then 01P00104## then ctrl C (ETX) and the command sends and receives data from the device using the exact same cables. That's why I suspect that its my code and not the cables.
Member 11780461
10-Jul-15 14:17pm
View
If it makes a difference, the connection is made by a usb to serial cable. Also, when I connect to another computer using putty or hyperterminal none of the messages appear on either screens but when that other computer connects to my serial device machine, it communicates
Member 11780461
10-Jul-15 14:06pm
View
most definitely it is correct, thanks again
Member 11780461
10-Jul-15 13:47pm
View
Ive made the changes that you suggested and edited the question for more clarity. Thanks for all your help as your suggestions gave me the correct translation but it seems that the problem is much deeper because the serial device still wont communicate even though the output from a loopback test delivers the correct commands. My next step will be to try in a separate thread will be new for me.
Member 11780461
10-Jul-15 13:19pm
View
Deleted
Posted a new question with my change if you have time to check out:
http://www.codeproject.com/Questions/1008564/How-to-get-Characters-Get-Bytes?arn=0
Member 11780461
10-Jul-15 13:19pm
View
Posted a new question with my change if you have time to check out:
http://www.codeproject.com/Questions/1008564/How-to-get-Characters-Get-Bytes?arn=0
Member 11780461
9-Jul-15 13:48pm
View
WinForms but it is in .net 2.0 framework. Not sure if that matters
Member 11780461
9-Jul-15 12:57pm
View
Im sorry but I would have no idea how to make that happen. Like I said, I have little experience. If you'd be willing to show me Id extremely appreciate it
Member 11780461
9-Jul-15 11:50am
View
Ok, Ill make that read in change, but where would you recommend I make the execution because I want the array command sent after I click on the link label.
Member 11780461
9-Jul-15 11:32am
View
http://www.codeproject.com/Questions/1008236/Sending-ASCII-Controls-STX-and-ETX
Member 11780461
9-Jul-15 10:43am
View
I am placing this is in wrong?
private void linkLabel_HC1_100_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
private const byte stx = 0x02;
private const byte etx = 0x03;
private byte[]WrapString(string send)
{
int length = send.Length;
byte[] data = new byte[length + 2];
data[0] = stx;
data[length + 1] = etx;
Array.Copy(System.Text.Encoding.ASCII.GetBytes(send), 0, data, 1, length);
return data;
}
byte[] data = WrapString("01P00102##");
}
Member 11780461
8-Jul-15 17:30pm
View
Checked the setting and they are the same as the working terminal. Any chance you code show me how to make it a byte array?
Member 11780461
7-Jul-15 15:18pm
View
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SerialPort
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
cmdClose.Enabled = false;
foreach (String s in System.IO.Ports.SerialPort.GetPortNames())
{
txtPort.Items.Add(s);
}
}
public System.IO.Ports.SerialPort sport;
public void serialport_connect(String port, int baudrate , Parity parity, int databits, StopBits stopbits)
{
DateTime dt = DateTime.Now;
String dtn = dt.ToShortTimeString();
sport = new System.IO.Ports.SerialPort(
port, baudrate, parity, databits, stopbits);
try
{
sport.Open();
cmdClose.Enabled = true;
cmdConnect.Enabled = false;
txtReceive.AppendText("[" + dtn + "] " + "Connected\n");
sport.DataReceived += new SerialDataReceivedEventHandler(sport_DataReceived);
}
catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error"); }
}
private void sport_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
DateTime dt = DateTime.Now;
String dtn = dt.ToShortTimeString();
txtReceive.AppendText("["+dtn+"] "+"Received: "+sport.ReadExisting()+"\n");
}
private void cmdConnect_Click(object sender, EventArgs e)
{
String port = txtPort.Text;
int baudrate = Convert.ToInt32(cmbbaudrate.Text);
Parity parity = (Parity)Enum.Parse(typeof(Parity), cmbparity.Text);
int databits = Convert.ToInt32(cmbdatabits.Text);
StopBits stopbits = (StopBits)Enum.Parse(typeof(StopBits), cmbstopbits.Text);
serialport_connect(port, baudrate, parity, databits, stopbits);
}
private void button1_Click(object sender, EventArgs e)
{
DateTime dt = DateTime.Now;
String dtn = dt.ToShortTimeString();
String data = txtDatatoSend.Text;
sport.Write(data);
txtReceive.AppendText("[" + dtn + "] " + "Sent: " + data + "\n");
}
private void cmdClose_Click_1(object sender, EventArgs e)
{
DateTime dt = DateTime.Now;
String dtn = dt.ToShortTimeString();
if (sport.IsOpen)
{
sport.Close();
cmdClose.Enabled = false;
cmdConnect.Enabled = true;
txtReceive.AppendText("[" + dtn + "] " + "Disconnected\n");
}
}
private void button2_Click(object sender, EventArgs e)
{
DateTime dt = DateTime.Now;
String dtn = dt.ToShortTimeString();
const char stx = (char)2;
const char etx = (char)3;
sport.Write(stx + "01P00202##" + etx + "\n");
txtReceive.AppendText("[" + dtn + "] " + "Sent: 01P00202##\n");
}
}
}
Invalid Operation Exception was unhandled under sport_Data Recieved.
Additional information: Cross-thread operation not valid: Control 'txtReceive' accessed from a thread other than the thread it was created on.
Not sure what that means but was the char items placed correctly?
Member 11780461
6-Jul-15 14:50pm
View
I thought that with little to no experience that I may have more luck finding an application which already exists in this format rather than creating my own serial port terminal. Is it simple to learn and create with the specifications I want?
Member 11780461
26-Jun-15 12:26pm
View
Yeah you are right about the time spent versus paying for the software. Thankfully I received the command set and was able to conduct commands from a host laptop. Thanks for the help
Member 11780461
26-Jun-15 12:24pm
View
Thanks for the steps. I received the manufacture's command set and followed your outline and was able to conduct its movement. Obviously you were right, I wouldn't have stood a chance without their command protocol
Member 11780461
22-Jun-15 1:10am
View
Business project. The inventory is within a storage warehouse. The storage system's company provides software to purchase that will allow this host connection I speak of but I am conducting research to understand if I am capable of programming it myself to avoid expanding my department's budget
Show More