SM terminal

   This program is simple terminal for COM port (or virtual USB-COM with FT232 or similar). It was designed mainly for simple text and binary communication with microcontrollers (I'm using it for debug purposes).
   It's written as multi thread application with separate threads for communication and user interface so it should work properly with higher baud rates. All operations that could take longer time can be canceled (like sending files) and there are also timeouts implemented so terminal should not "freeze" if communication is blocked.
   Problems are only with FT232 which drivers has some bug (FTDI calls it feature) that makes impossible to close port if there are some unsend data in transmitt buffer (this could cause problems if transfer is permanently blocked with flow control signals). Even process kill has no effect here.
   Program was developed in BDS2006 Turbo C++ and tested only in M$ Windows XP so I have no idea how this will work in newer OS versions but I'm pretty sure that it won't work in systems older than Windows 2000 (changes in used api).

1 - Settings

   Port settings can be done in menu "Port->Settings". It should allow you to choose one of unsused ports and set basic communication parameters. You can set almost anything but not all values/combinations are valid (it can be set but it will not work)! It differs for each device/driver. Physical COM ports usually allows to set only basic baud rates up to 115200bd. If you are using virtual USB-COM then you can set any baudrate you want in custom fields but not all values are valid! Drivers will set automatically nearest valid value.
   All theese setting can be done also in "config.ini".

COM port settings

1.1 - "config.ini"

   In this file you can make all port settings described further and also some special settings. I strongly recomend you to not change any special settings if you don't know what it does!
   In section [TXTVIEW] you can enable invisible character replacement with some printable symbol. You can also specify line break mark for the viewer (it can be also set in the menu).
   In section [PORT] there are some special settings that allows you to change some of internal values of the terminal. At first there are settings for serial port drivers. You can modify length of rx and tx buffer allocated by port drivers through values "port_rx_size" and "port_tx_size". For higher transfer rates it's better to use at least 8kiB buffers. For low transfer rates the sizes can be as small as 256B. It is also possible to enable auto limitation of tx buffer size (option "port_tx_size_lim"). The size will be reduced to some 1.5s of data (min 128B). You can also specify rx timeout intervals. This settings could be usefull for very low transfer rates where default interval could be to short for larger data blocks. Detailed description of theese values can be found in MSDN library (Communications Functions: "SetCommTimeouts()" and "SetupComm()" functions).
   As I've mentioned erlier rx and tx functions are placed in separated threads to ensure communication will work independently to GUI and theese threads of course needs some FIFO buffers. You can modify those two buffer sizes through values "port_rxth_size" and "port_txth_size" if you wish but default 1MiB should be OK even for highest transfer rates and high CPU usage. You can also modify sleep intervals for both threads. The thread goes to sleep mode if there are no data or buffers are full. Values "port_rxth_sleep" and "port_txth_sleep" specifies minimum amnount of time in miliseconds for which the thread is suspended by OS. For high transfer rates theese values should be lower but for low transfer rates theese intervals could be stretched (lower CPU usage but potential risk of port driver rx buffer overflow).
   Last value you can set in [PORT] is "port_rx_data_block_size". That's an memory allocation step for recieved data buffer.

2 - Terminal usage

2.1 - Page "Text"

   Here are displayed recieved data formated as text. Invisible characters can be ignored or replaced with specified symbol. You can choose one of line break marks in menu "Rx->Text". This has effect only for newly recieved data or after click at "Rx->Text->Refresh text". View is refreshed only 10 times per second, for higher data rates refresh period is reduced down to 1s. Recieved text can be saved into file in menu "Rx->Text->Save".

Page text

2.2 - Page "HEX"

   This is simple HEX viewer for recieved binary data. Same as in page "Text" it's refreshed only 10 times per second. Binary data can be saved to file in menu "Rx->Binary". You can save all data or selected range. Selection can be made by shortcuts "Ctrl+B" and "Ctrl+E" or numerically.
   Tools at bottom of the page allows you to analyze multibyte integer constants in different formats (1 to 8 bytes wide, signed or unsigned in any order). Double click in any yellow filed stores it's content into clipboard.

Page HEX

2.3 - Page "Info"

   Here you can see some informations about opened port.

Page info

2.4 - Sending data from terminal

   Data can be send directly from keyboard (if button "From keyboard" is pushed). In this mode "Enter" sends CR and "Shift+Enter" sends LF symbol. You can also send some special characters like end of line (EOL) where mark type is the same as selected in "Rx->Text", end of file (EOF) which has value 0x00 and tabulator (value 0x07).
   You can also send binary data from a file (button "Send file"). The data transfer can be holded or stopped in any moment. There is also some timeout implemented so if data transfer is permanently blocked then it is automatically stopped.

Sending strings

   It is also possible to send strings terminated with various EOL and EOS marks including custom ones.
   Last thing you can do is to send an integer constant in different formats (button "Send integer"). Terminal supports integer ranges from 1 upto 8 bytes signed or unsigned, in any byte order.
   Transfered data are not displayed in text and hexa viewer (it is almost impossible to combine them with recieved data since I'm using block transfers)!

Sending file Sending integer

3 - History of versions

V0.90 - 22.2.2011: First release.
V1.00 - 21.6.2011: Extended settings in "config.ini", better text viewer (line break marks), better hexa viewer (block selection for export) and some new buttons for sending special characters.
V1.30 - 12.2.2012: Extended settings in "config.ini", new hexa viewer cursors, auto limitation of refresh speed for high transfer rates, new send string function. Fixed file sender (if it was holded and than canceled the terminal sent rest of internal buffer).
V1.35 - 7.4.2012: Added history to "Send string" function. Few minor bugs fixed.
V1.36 - 9.8.2017: Fixed "Send string" function - it was sending only CR termination character.

4 - Licence

   It's freeware so you are free to use and redistribute it but only with all included files together (especially with this help) without any modifications!
   Since it's freeware you are using this at you own risk! Any possible dammage caused by this SW is your problem.
   If you don't agree with theese terms don't use this SW.

5 - Contact

   In case of some problems with this SW you can contact me at s.maslan@seznam.cz. Additional informations and new versions could be find here: http://www.elektronika.kvalitne.cz/SW/SM_terminal/SM_terminal.html.

(c) 2011-2012, Stanislav Mašláň - All rights reserved.