|
i want termite source code in c++ instead of c#.
please anyone help me in this matter.
as i am using serial communication in vc++ i am getting 37 byte packet in 3 second and that is too much.
so i need help in this .
|
|
|
|
|
Hello,
Would like to talk to you about an application very similar to this. Could I get your email? Or you can contact me @ cam@slytrackr.com
Thanks,
Camoren
|
|
|
|
|
Thanks for sharing this, it is very well done and just what I needed as a base for my Embedded Design Work. 
|
|
|
|
|
I want to read data from a RS485 port which will be connected using a convertor to USB
is it possible to read the data just like the RS232 port?
|
|
|
|
|
Why sometime the "Windows Form" not closed after click close button?
I think the "StopReading" is a block routine, when closing the form and still reading from comport, so the _readThread never could stop it.
Modified the code as
if (_keepReading)
{
_keepReading = false;
_readThread.Join(100); // teminate thread on 100ms until exits
_readThread.Abort(); // sure it happen
_readThread = null;
}
the form will close always.
modified 3-May-13 14:19pm.
|
|
|
|
|
Hi Milkplus,
Thanks a lot. Your code help me a lot to complete my project. I want to plot the data's that are received through the serial port. i am new to C#. Actually i will send 4 sets of data every second from a microcontroller. So i want to plot four different graphs. Could you please help me out to solve the issue. i am trying my level best.
I succeeded in transmitting my data to PC. Now the issue is to plot.
Thanks in advance.
|
|
|
|
|
I would like to filter out null characters and some non Ascii characters from the display. Could you give some examples of the syntax for the filtering option?
Thanks
|
|
|
|
|
Hello Milkplus (Mr. David McClurg). I am very happy because your Termie application is the first one that runs and works perfectly. Thank you. I have some questions related to the serial communication field that I would like to ask you. Is it possible to get your Zynga email or a personal? If so, please, could you send to me a private email? Thank you again. Wilfredo
|
|
|
|
|
To my understanding, this message is related to "file open" and "file close" (or opening/closing serial ports) functions of operating systems, specifically closing down termie without closing the serial port connection (by powering down the target device). Could someone elaborate on this, and also how to "fix" this problem. Closing termie and resetting the target device, and disabling/enabling the serial port usually work, but not always
|
|
|
|
|
Hi Milkplus, I`m Ocaccy
Forgive my poor English.
Got your code here in the Code Project
I ask your permission to use parts of your code on my Japanese System.
When they sending the command to the device, returns this sequence.
The first line is the command echo.
Do you can help me to appear Kanji, Hiragana and Katakana?
2011年8月11日 11:40:04 main
?@?@?@?@Main???j???[
1: Run ????????
2: Id?@????????
? Ver.121
?
Thank you,
oohashi
ocaccy@gmail.com
|
|
|
|
|
I'm not sure. Perhaps using the fix by Greg Lapin will work. Change ASCII to UTF8 in the code.
Re: Only ascii characters up to 127dec are supported. All bytes above 127 are converted to the ? character.
> Greg Lapin wrote:
In CommPort.cs there is a command:
String SerialIn = System.Text.Encoding.ASCII.GetString(readBuffer,0,count);
and the "ASCII" term is defined as "Gets an encoding for the ASCII (7-bit) character set."
Changing this to "UTF8" fixes the 7-bit limit and allows 8-bit values to be displayed.
|
|
|
|
|
Thank you for your quick response.
I put in as your answer, but did not work.
It worked with the DEFAULT.
SerialIn System.Text.Encoding.Default.GetString String = (ReadBuffer, 0, count);
Thank you for teaching me where I should change.
Forgive me for disturbing you.
I changed the line that receives the LOCALECHO.
if (Settings.Option.LocalEcho)
{
outputList_Add (DateTime.Now.ToLongDateString () + "" + DateTime.Now.ToLongTimeString () + "" + MAIN + "\ n", sentColor);
}
It worked for the echo.
In the system I need to put the date in standard Japanese in front of the line that is captured from the serial.
Teach me where this line so I can change please.
Best Regards,
ocaccy
|
|
|
|
|
 Hello Milkplus,
We can make the code to put the date in Japanese, taking the empty spaces with Trim (),
find a position with IndexOf (), taking a piece of string with substring (),
Transfomer with Convert.ToInt32 (), etc. ..
Let's go to the second part; Dynamic plotting with the result above.
Do you know anything to help us? I would like to join our project?
Come on, you're very good at this guy.
The code.
public void logFile_writeLine4(string stringOut)
{
stringOut=stringOut.Trim();
if(stringOut.Contains("01"))
{
int pos=stringOut.IndexOf("clean");
string XOVEx=stringOut.Trim().Substring(0,pos-2)+" "+DateTime.Now.ToLongDateString()+" "+DateTime.Now.ToLongTimeString()+"\n";
textBox5.AppendText(XOVEx);
string XOVE=stringOut.Trim().Substring(0,pos-2);
string varID=textBox5.Text.Substring(0,2);
int varIDint=Convert.ToInt32(varID);
listBox1.Items.Add(varIDint);
string varch2m=textBox5.Text.Substring(3,5);
int varch2mint=Convert.ToInt32(varch2m);
listBox2.Items.Add(varch2mint);
string varch7m=textBox5.Text.Substring(9,5);
int varch7mint=Convert.ToInt32(varch7m);
listBox3.Items.Add(varch7mint);
string varch10m=textBox5.Text.Substring(15,5);
int varch10mint=Convert.ToInt32(varch10m);
listBox4.Items.Add(varch10mint);
if(stringOut.Contains("Main")||stringOut.Contains("Run")||stringOut.Contains("Ver")||stringOut.Contains("2:"))
{
}
else
{
Stream myStream=File.Open("F:/USUARIOS/dtp2/SAIDAX/soIDLog.CSV",
FileMode.Append,FileAccess.Write,FileShare.Read);
if(myStream!=null)
{
StreamWriter myWriter=new StreamWriter(myStream,Encoding.UTF8);
myWriter.WriteLine(DateTime.Now.ToLongDateString()+","+DateTime.Now.ToLongTimeString()+","+XOVE);
myWriter.Close();
}
}
}
}
|
|
|
|
|
I'm trying to learn c#.
I'm working on termie to make it a sniffer for my microcontrollers projects.
Actually I send from my microcontroller a frame < data > < end of frame >.
In OnDataReceived(string dataIn) I've changed EndsWith, with my < end of frame >. After I try to parse the StringIn (0,4 => destination, 4, 8 => source, 8 ctrl, then data) to give it a fancy and more readable style.
I try different solutions, but everytime I get NullReferenceException in Invoke(new StringDelegate())
Where is the right place to make parsing of data?
This is my work (exception: Index out of range, Invoke(new StringDelegate(OnDataReceived), new object[] { dataIn });):
public void OnDataReceived(string dataIn)
{
string StringIn = null;
bool done = false;
// Handle multi-threading
if (InvokeRequired)
{
Invoke(new StringDelegate(OnDataReceived), new object[] { dataIn });
return;
}
// pause scrolling to speed up output of multiple lines
bool saveScrolling = scrolling;
scrolling = false;
// if we detect a line terminator, add line to output
int index = 0;
while (dataIn.Length > 0 &&(dataIn.EndsWith("\r\r\r\r")))
{
index = dataIn.IndexOf("\r\r\r\r");
StringIn = dataIn.Substring(0, index);
dataIn = dataIn.Remove(0, index + 4);
logFile_writeLine(AddData(StringIn).Str);
partialLine = null; // terminate partial line
done = true;
}
if (done == true)
{
DateTime date1 = DateTime.Now;
string Frame = " Time : ";
Frame = Frame + date1.ToString(("hh:mm:ss.fff"));
Frame = Frame + " Dest.: ";
foreach (char c in StringIn.Substring(0,4))
{
Frame = Frame + String.Format("{0:X2}", (int)c);
}
Frame = Frame + " Source : ";
foreach (char c in StringIn.Substring(4,4))
{
Frame = Frame + String.Format("{0:X2}", (int)c);
}
Frame = Frame + " Ctrl: " + String.Format("{0:X2}", (int)StringIn[9]);
infoLine = outputList_Add(Frame, receivedColor);
done = false;
}
// if we have data remaining, add a partial line
if (dataIn.Length > 0)
{
partialLine = AddData(dataIn);
}
// restore scrolling
scrolling = saveScrolling;
outputList_Scroll();
}
modified on Thursday, January 20, 2011 10:21 AM
|
|
|
|
|
If I was going to write termie again, I'd avoid invoke. It always gives me problems. A better way to handle it is with a "lock" on a shared buffer. The producer (comm thread) adds to the buffer and the consumer (UI thread) copies the buffer to another buffer and clears the shared buffer. Both use lock(buffer) before accessing it. Does that make sense? That may help.
|
|
|
|
|
Termie seems to work just great, and I'd like to use some of the code in a custom program of my own.
I've got 2 problems:
1) I'm a C# neophite I've gotten myself into a C# project, and I'm learning as I go (not the best way I realize).
2) I'm having problems switching comm ports in my program. When I startup, I do a com.Open(), and everything works just fine. But, my code needs to search through the available comm ports to find an attached device. Whenever I change port (com.Close(); Settings.Port.PortName = "COM10"; com.Open();) if a character is received, I can't Close() the port! It hangs up waiting for the thread to finish.
I know that I'm asking a lot, but do you have any idea what might be happening (remembering that I'm VERY much a C# novice at this point).
Steve
|
|
|
|
|
Hello.
I'm using Termie with an application which sometimes requires setting up a transmit delay (15 to 30 ms per line) to ensure that it is able to process correctly the transmitted file.
There is such a feature in HyperTerm and Tera Term.
In Tera Term :
Transmit delay = (x) msec/char (x) msec/line
Would it be possible to implement this feature in Termie ?
Thanks for your reply!
Eric
|
|
|
|
|
I like Termite's ability to handle non-standard baud rates, but wanted the ability to send a file.
I like Termie's ability to send a file, but wished you had kept the non-standard baud rate functionality.
I like the fact that both can be distributed as an exe/ini combination.
|
|
|
|
|
PS.... if there are road blocks you know of required to support non-standard baud rates, let me know!
Termite does some weird things in terms of what 'non-standard' baud rates can be specified and how they are quantized. I suppose maybe it has something to do with what the hardware will support.
|
|
|
|
|
system.io.ports.serialport.baudrate
can be set to anything from 0 to the max baud rate for the device.
You could easily modify the baud rate table in the code for Termie
Int32[] baudRates = {
100,300,600,1200,2400,4800,9600,14400,15000,19200,
38400,56000,57600,115200,128000,256000,0
};
I added the non-standard baud rate 15000. Hope that helps.
|
|
|
|
|
You suppose correctly! Not all serial ports (or virtual serial ports) support non-standard baud rates. When you pass in a baud rate that the hardware does not support, the serial driver may return "failure", but it may also (silently) clamp the baud rate to the nearest value that it does support.
In my experience, the standard serial ports on PC motherboards rarely support non-standard baud rates. If you use USB-to-RS232 converters, use one with an FTDI chip. Most (cheap) converters have a Prolific chip, its support for non-standard baud rates is not great.
I am the author of Termite, by the way, and found out the above when using Termite in a MIDI chain (MIDI is basically RS232 current-loop with a baud rate of 31250 bps).
|
|
|
|
|
Hi milkplus,
I have a couple of questions:
1. When sending data, I need to move the cursor about 10 positions to the right to delete previous characters before I enter new text. How could I do that? it appears that there is no ascii characters for the right or left arrows. Is there a way to overwrite current text?
2. What code changes do I have to make to emulate vt100?
3. In regard to sending hex code:
Do I need to send ff at the end of the stream? i.e. \x01\x02\x5f\ff or \x01\x02\x5f is fine (without ff at the end).
Thanks for sharing such a great application!
xplorer2k
|
|
|
|
|
This source code is just cool! i've been looking for this kind of project since long ago, but after i opened the .zip code, wow! There's so many files.
i want to achieve: sending data from a PS3 controller (playing game in my PC with a PS3 controller) through RS-232 to a PIC 16f84 IC (8 channel servo controller).
Is it possible to include all the code into 1 file for easy reading?
Pls reply, i really curious & want to try the code out!
Thank you very much!!!!
modified on Saturday, September 12, 2009 10:54 AM
|
|
|
|
|
Thanks for your effort and sharing it with us. It is grate and gave me lot of help that I have been searching for a week. Thanks again and keep it up.
|
|
|
|
|
I'm pretty new to programming (anything) but...
I have this string:
BE EF 10 05 00 c6 ff 11 11 01 00 01 00
it's to turn on a video projector.
I cant seem to get it to work in hex mode... any ideas on a way to convert it?
|
|
|
|
|