9 Search Result
If you are familiar with t scripts, you know that they are based on “hooks”. Hooks are like interrupts. The runtime engine waits for these hooks, then executes the code that is inside its code block. For example, let’s say you need to respond to a CAN message with an ID of 0x200. The t script code would look something like:
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.
Environment variables are used to communicate between different t programs or with a PC using CANlib. Figure 1 shows three scripts that are currently running on a Kvaser device. When Script 1 sets an environment variable, the new value will be available for reading in the other scripts, as well as from a PC using CANlib. In addition to this, a script may also declare a hook that is run whenever a specific environment variable value is set.
In this last part of the environment variable series, we’ll see how we can interact with environment variables using the Kvaser TRX. Kvaser TRX is a light weight IDE for developing t programs for Kvaser devices and is included in the CANlib SDK 1. Full program listings are available on http://github.com/Kvaser/developer-blog.
We have been using t-Scripts to tackle a wide variety of cases lately. Here’s a list for a little inspiration for your projects:
- handheld reflashing/recalibration tools
- node simulators
- CAN FD gateways with data encryption
- light Hardware-In-the-Loop controllers
With each project, there are hurdles to overcome, and it seems like we consistently revisit 3 resources.
The t programming language is compiled on the developer’s PC into efficient byte code for execution on t-capable hardware i.e. the Kvaser USBcan Pro or Memorator Pro series. As an event driven language – where the program flow is determined by events such as incoming CAN messages – t programs support functions that respond to events, such as timers, floating point calculations, structures, recursion and file access.
This is the second post in a 3-part series about Environment Variables in t programs:
- Introduction to Environment Variables
- Accessing Environment Variables from CANlib
- Kvaser TRX and Environment Variables
The first post in this series introduced the environment variable and showed how the environment variable can be used in a tprogram. This second post shows how environment variables can be accessed using CANlib. Full program listings are available on http://github.com/Kvaser/developer-blog.
t Programs (or scripts) are simple-to-develop programs that allow you to customize your Kvaser device to do just about anything but make the tea. In this course, Judson Brundage (of Exclusive Origin, a Kvaser Technical Associate) introduces the t programming development environment, and walks you through creating your first t script.