How to execute a command (macro) in Tera Term, like to toggle DTR and RTS signals

serial-portteraterm

How do I make Tera Term toggle DTR and RTS, or execute any of its custom commands in the Tera Term language (TTL)?

I have an electronics project that uses an FTDI chip as the serial interface between PC and the electronics board. I need to communicate to the FTDI chip to toggle the DTR and RTS pins, which are set to control various system states.

Best Answer

Tera Term has an entire scripting language called Tera Term Language (TTL). You can find all the commands on their website. The question is how do you execute a command?

Tera Term will execute commands from a TTL file. Create a text file with your one command, or any number of commands, and save the file with a .TTL extension.

In Tera Term click the "Control" menu, then select "Macro". This will allow you to navigate to your TTL file.

There are example TTL files in the Tera Term installation directory.

Also, a side detail I didn't see explained anywhere else: it is perfectly ok to change any of the serial port settings, without needing to disconnect and reconnect. You will need to rerun your macros, however. In my case, if I changed from 9600 baud to 115,200 baud, I would need to rerun my script to enable DTR and RTS.

My TTL file looks like this:

; enable dtr
setdtr 1

; clear rts
setrts 0

; now clear dtr, so that the system will reset and see rts clear
setdtr 0
Related Topic