Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PC Terminal Program with C# Source Code

Len_CONSULTRON
Level 9
Level 9
500 solutions authored 1000 replies posted 750 replies posted

Here is the C# source code to a terminal program for a Windows PC.

Minimum System Requirements:

  • Windows 7.  A lower version may work but has not been tested.
  • C# Compiler.  I have compiled this on both Visual C# 2017 and 2019.

This code started as a simple PSoC UART (remote) to PC terminal application to replace Teraterm, Termite, RealTerm, etc.

I did this to eventually enhance the UART comm capabilities to include features such as

  • Data logging (appending to a .csv file)
  • Data Plotting.  This includes saving the plots as a .png file or .csv.

This code has those features built in by using my packetizing protocol.

Disclaimer

You are allowed to use this source code “at-will” for commercial or non-commercial purposes. I DO NOT state or imply any warranty for the use of this code in-whole or in-part.

I've attached an archive of the source code and a .pdf that describes the use and the packetizing protocol.

Len

Message was edited by: Len Removed bin and obj directories. Makes for a smaller .zip. Will be rebuilt when compiled.

Len
"Engineering is an Art. The Art of Compromise."
10 Replies
JeetendraA_51
Moderator
Moderator
Moderator
10 replies posted 5 replies posted First reply posted

Thank you Len for sharing this project!

0 Likes
Nohi_3499266
Level 1
Level 1

Thank you so much for sharing this source code... This is great!!!

Regards

Normanj

https://appvalley.one/

0 Likes
ravo
Level 5
Level 5
5 solutions authored 100 replies posted 250 sign-ins

Dear @Len_CONSULTRON , thanks for nice work. Can you also provide BIN for test purpose, maybe in separate ZIP ?

Best Regards

Radim

0 Likes

ravo,

Try this.

 

Len
"Engineering is an Art. The Art of Compromise."

Dear @Len_CONSULTRON ,

thanks for sending compiled program.

Regards

Radim

0 Likes

Radim,

This archive comes from the VSS 2019 publishing option.

Theoretically, it should contain everything needed to install the project binary on your PC.  Theoretically ...

I have not tested this on another PC that does not have my setup.

Please verify that this works OK for you.

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

Dear @Len_CONSULTRON 

i just tried to test the app, but I am not able to view or modify COM port settings (baudrate, parity etc..) . Are there some dialog with these settings ?

Radim

0 Likes

ravo,

You are correct.  The UART comm of 115200 baud 8N1 is "hard-coded" in the program.  This is the most common mode that I use it therefore I did not see the need to have a means to change it.   The data rate is fast but not too fast.

However, it can be changed by modifying the source code.  Very easy to do!

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

Dear @Len_CONSULTRON ,

thanks for response and confirmation. I also use this baudrate for ddebug & testing purpose. But for industrial application i use preferably 19200 with some kind of CRC due harsh (noisy) environment.

Best Regards

Radim

0 Likes

ravo,

Microsoft offers a version of their development IDE free.  (Consult Microsoft for commercial use limitations of the use of this product.)

Right now, Visual Studio 2022 is available for free download.

If you download and install this product and download the Terminal source code I provide, you should be EASILY able to change it.

Double-click on the Uart.sln.  It will launch the version of Visual Studio you installed.

Look for "Uart/Properties/Settings/Serial_Baudrate". (Shown in the RED boxes below.)

Len_CONSULTRON_0-1671716095689.png

Here you can easily change it to the desired baud rate you want to support.  Note:  in this version of "Uart" the protocol "8N1" is also hard-coded but can be changed by further changes in the program.

As for CRC ... that's a bit more difficult.

The "Uart" terminal program was designed for "simple" Uart communication (ie Baudrate @  8N1).  It assumes non-packetized serial communication but rather a byte-by-byte character passing of information between the target terminal device and the PC.

A CRC-based protocol basically requires that the data be packetized.  This is definitely possible.  In fact, I support my own proprietary packetized protocol in Uart for passing data streams and for plotting.  However, it doesn't support CRC verification.  It could but doesn't.

You can use this source code as a launching point to add packetized/CRC validated data.   I do recommend that you first compile and run the code "as-is".  This proves that your design environment is configured properly.  Then you can modify the code with confidence.

This source is free for you to modify royalty-free for public or commercial use with no warrantees expressed or implied.

Len
"Engineering is an Art. The Art of Compromise."
0 Likes