Getting Started with t Programming

  • April 29, 2015
  • check-paym check-pay
This is the first part of a series.

The new Kvaser professional 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 Professional product(*1). The software needed is installed with CANlib SDK and called Kvaser TRX.

_DSC0971-Edit-4

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 professional 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.

image2

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 support@kvaser.com.

Author Image

check-paym check-pay

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. abc