Get Adobe Flash player
FacebookTwitterGoogle+
English Arabic French German Italian Portuguese Russian Spanish

Did you know?

In the late-1800s, Nikola Tesla pioneered the generation, transmission, and use of alternating current (AC) electricity, which can be transmitted over much greater distances than direct current. Tesla's inventions used electricity to bring indoor lighting to our homes and to power industrial machines.
 

Help us stay online:

small donate

terminal scripting windowThis is tutorial on how to configure com port terminal - development tool to send predefined strings with delay between them, how to read incoming data and process these data and how to use debug console. Recently I read about the problem one man had. He needed to send strings to COM port with 50ms delay between them. Here is the solution.

If you try to use windows terminal for sending data to COM port, you cannot type in data so fast and if you use option to send file with text inside it, there will be no delay between and that becomes big problem.
Solution is to use scripting option inside com port terminal - development tool. Inside scripting window you can make small pascal syntax program. If you haven't programmed in pascal before, do not worry. I will give you here one simple example that will cover usual loops and conditions that you will need to use to solve problems.
To enter scripting editor click on scripting button of terminal tool.

terminal scripting window

Here we connected two COM ports to each other, COM10 and COM11 in my case. We started two terminals. One with scripting options and other in normal operating mode to simulate device that you want to comunicate with via COM port. Enter code below inside scripting window:

//read more about this at www.Electronics-Base.com
program ScriptTest;
const STRING1 = 'first test by www.Electronics-Base.com';
const STRING2 = 'second test after delay www.Electronics-Base.com';
const STRING3 = 'third test after delay www.Electronics-Base.com';
var i: longint;
begin
  writeln('Test 3...');
  comsendstr(STRING1);
  Delay(1000);
  comsendstr(STRING2);
  Delay(1000);
  comsendstr(STRING3);
  // send alphabet
  for i:=65 to 90 do
  begin
    comsendchr(i);
  end;
  while (not(i=27)) do // wait for ESC char
  begin
  i:=0;
  while i=0 do   i:=ComReadChr();
      if (i=ord('1')) then writeln('Test 1...');
      if (i=ord('2')) then writeln('Test 2...');
      if (i=ord('3')) then writeln('Test 3...');
  end;
  writeln('while loop exit');
end.

Select COM port and baud rate and connect to it. When you press RUN button in scripting window script will write predefined strings with 1000ms delay between them to COM port. Then for loop will write whole alphabet to COM port. After that if ’1’, ’2’, or ’3’ are received on COM port ,script will write Test 1, 2 or 3 in DEBUG FIELD of scripting window. This will NOT be sent to COM port. You can use the command writeln to send yourself messages without influence on COM port communication. At the end after receiving ESC key kode (27) it exits this loop and writes while loop exit to debug field.
On video below you can see how this works in practise.


 

For more options and all available commands press help button of com port terminal - development tool.

terminal scripting help