Developer Blog

29/04/2015 by Magnus Carlsson

Getting Started with t Programming

The new Kvaser Pro products have script feature called t. The t language is a ‘c like’, event oriented language. The t-programs run on the device and can be loaded and started either from a pc or autonomously on the device. This is a short introduction to get started with t programming.

To be able to test and run a t program you need a Kvaser Pro product. The software needed is installed with CANlib SDK and called Kvaser TRX.

can bus tutorial

To get up and running and write your first t program, start by downloading and installing CANlib SDK (Download) then start TRX.

It will look something like this:image1

In the <New> tab enter:

on start {
  printf("Hello World!\n");

This a very basic program that reacts on an ‘on start’ event and prints “Hello World!” in the ‘Device Output’. It is the actual device that sends the “Hello World!” to the computer and that TRX reads.

Then choose Run->Compile from the menu. To be able to compile you first have to save the t program, TRX will prompt you for this, and it will also prompt you to save a project file. I saved it as blogpost1.

If the compilation succedes the next step will require an actual Kvaser Pro product.

I connected a Kvaser Memorator Pro 2xHS v2 (View Product). You can see that TRX can use your device if the combo box just under the menu bar has the name of your Kvaser device.

To test the t program, just go to Run->Download, this will download the t program to the device. Next step will be to actually run the program. Run->Run will start he application, thus hopefully you will see the printf printout in the Device Output window.


Additional resources:

  • The description of the t language can be found in the The Kvaser t Programming Language specification (View).

Comments?  Contact us directly at

Author Image

Magnus Carlsson

Magnus Carlsson is a Software Developer for Kvaser AB and has developed firmware and software for Kvaser products since 2007. He has also written a number of articles for Kvaser’s Developer Blog dealing with the popular Python language.