WP_Query Object
(
    [query] => Array
        (
            [paged] => 40
            [pagename] => about-us/news
        )

    [query_vars] => Array
        (
            [paged] => 40
            [pagename] => about-us/news
            [error] => 
            [m] => 
            [p] => 0
            [post_parent] => 
            [subpost] => 
            [subpost_id] => 
            [attachment] => 
            [attachment_id] => 0
            [name] => 
            [page_id] => 0
            [second] => 
            [minute] => 
            [hour] => 
            [day] => 0
            [monthnum] => 0
            [year] => 0
            [w] => 0
            [category_name] => 
            [tag] => 
            [cat] => 
            [tag_id] => 
            [author] => 
            [author_name] => 
            [feed] => 
            [tb] => 
            [meta_key] => 
            [meta_value] => 
            [preview] => 
            [s] => 
            [sentence] => 
            [title] => 
            [fields] => 
            [menu_order] => 
            [embed] => 
            [category__in] => Array
                (
                )

            [category__not_in] => Array
                (
                    [0] => 1047
                )

            [category__and] => Array
                (
                )

            [post__in] => Array
                (
                )

            [post__not_in] => Array
                (
                )

            [post_name__in] => Array
                (
                )

            [tag__in] => Array
                (
                )

            [tag__not_in] => Array
                (
                )

            [tag__and] => Array
                (
                )

            [tag_slug__in] => Array
                (
                )

            [tag_slug__and] => Array
                (
                )

            [post_parent__in] => Array
                (
                )

            [post_parent__not_in] => Array
                (
                )

            [author__in] => Array
                (
                )

            [author__not_in] => Array
                (
                )

            [orderby] => date
            [post_type] => Array
                (
                    [0] => post
                    [1] => developer_blog
                )

            [post_status] => publish
            [order] => DESC
            [tax_query] => Array
                (
                    [0] => Array
                        (
                            [taxonomy] => blog-group
                            [field] => slug
                            [terms] => Array
                                (
                                    [0] => public
                                )

                            [operator] => IN
                        )

                    [1] => Array
                        (
                            [taxonomy] => blog-group
                            [field] => slug
                            [terms] => Array
                                (
                                    [0] => general-user
                                    [1] => technical-asociate
                                    [2] => qualified-sales-representative
                                    [3] => kvaser-internal
                                )

                            [operator] => NOT IN
                        )

                )

            [ignore_sticky_posts] => 
            [suppress_filters] => 
            [cache_results] => 1
            [update_post_term_cache] => 1
            [lazy_load_term_meta] => 1
            [update_post_meta_cache] => 1
            [posts_per_page] => 10
            [nopaging] => 
            [comments_per_page] => 50
            [no_found_rows] => 
            [taxonomy] => blog-group
            [term] => public
        )

    [tax_query] => WP_Tax_Query Object
        (
            [queries] => Array
                (
                    [0] => Array
                        (
                            [taxonomy] => blog-group
                            [terms] => Array
                                (
                                    [0] => public
                                )

                            [field] => slug
                            [operator] => IN
                            [include_children] => 1
                        )

                    [1] => Array
                        (
                            [taxonomy] => blog-group
                            [terms] => Array
                                (
                                    [0] => general-user
                                    [1] => technical-asociate
                                    [2] => qualified-sales-representative
                                    [3] => kvaser-internal
                                )

                            [field] => slug
                            [operator] => NOT IN
                            [include_children] => 1
                        )

                    [2] => Array
                        (
                            [taxonomy] => category
                            [terms] => Array
                                (
                                    [0] => 1047
                                )

                            [field] => term_id
                            [operator] => NOT IN
                            [include_children] => 
                        )

                )

            [relation] => AND
            [table_aliases:protected] => Array
                (
                    [0] => wp_term_relationships
                )

            [queried_terms] => Array
                (
                    [blog-group] => Array
                        (
                            [terms] => Array
                                (
                                    [0] => public
                                )

                            [field] => slug
                        )

                )

            [primary_table] => wp_posts
            [primary_id_column] => ID
        )

    [meta_query] => WP_Meta_Query Object
        (
            [queries] => Array
                (
                )

            [relation] => 
            [meta_table] => 
            [meta_id_column] => 
            [primary_table] => 
            [primary_id_column] => 
            [table_aliases:protected] => Array
                (
                )

            [clauses:protected] => Array
                (
                )

            [has_or_relation:protected] => 
        )

    [date_query] => 
    [queried_object] => WP_Post Object
        (
            [ID] => 1277
            [post_author] => 38
            [post_date] => 2014-11-21 12:03:40
            [post_date_gmt] => 2013-12-19 15:28:51
            [post_content] => 
            [post_title] => News
            [post_excerpt] => 
            [post_status] => publish
            [comment_status] => open
            [ping_status] => open
            [post_password] => 
            [post_name] => news
            [to_ping] => 
            [pinged] => 
            [post_modified] => 2021-08-12 09:14:30
            [post_modified_gmt] => 2021-08-12 09:14:30
            [post_content_filtered] => 
            [post_parent] => 23
            [guid] => https://www.kvaser.com/?page_id=1277
            [menu_order] => 5
            [post_type] => page
            [post_mime_type] => 
            [comment_count] => 0
            [filter] => raw
        )

    [queried_object_id] => 1277
    [request] => SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1  AND ( 
  wp_term_relationships.term_taxonomy_id IN (1026) 
  AND 
  wp_posts.ID NOT IN (
				SELECT object_id
				FROM wp_term_relationships
				WHERE term_taxonomy_id IN (1025,1027,1028,1029)
			) 
  AND 
  wp_posts.ID NOT IN (
				SELECT object_id
				FROM wp_term_relationships
				WHERE term_taxonomy_id IN (1058)
			)
) AND wp_posts.post_type IN ('post', 'developer_blog') AND ((wp_posts.post_status = 'publish')) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 390, 10
    [posts] => Array
        (
            [0] => WP_Post Object
                (
                    [ID] => 39871
                    [post_author] => 14
                    [post_date] => 2015-09-01 13:24:13
                    [post_date_gmt] => 2015-09-01 13:24:13
                    [post_content] => [vc_row][vc_column][vc_column_text]This is the first post in a 3-part series about Environment Variables in t programs:
  1. Introduction to Environment Variables
  2. Accessing Environment Variables from CANlib
  3. Kvaser TRX and Environment Variables
[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]This first post introduces the environment variables and shows how they can be used in a t program. 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.[/vc_column_text][vc_single_image image="8108" img_size="full"][vc_column_text]Figure 1: An overview of how the information about the environment variable's value is distributed.[/vc_column_text][vc_column_text]The term "envvar" is often used as a shorthand writing for the longer environment variable. For full documentation, read the Kvaser t Programming Language documentation 1. An environment variable can only be defined in an envvar section in a t program. Just like a variable defined in a variables section, an environment variable is visible globally. This is equivalent to defining something in global scope in a C program, i.e. the variable is visible between the declaration and the end of the compilation. The type of an environment variable can be either int, float or an array of char.[/vc_column_text][vc_code_raket header="Definition of environment variables" code="ZW52dmFyJTIwJTdCJTBBJTIwJTIwY2hhciUyME1lc3NhZ2UlNUIxMjglNUQlM0IlMEElMjAlMjBpbnQlMjBTZXZlcml0eSUzQiUwQSUyMCUyMGludCUyMEhvc3RJZFJlcXVlc3QlM0IlMEElMjAlMjBpbnQlMjBIb3N0SWRDb25uZWN0ZWQlM0IlMEElN0Q="][vc_column_text]The size of an environment variable is limited to ENVVAR_MAX_SIZE (4096 in version 3.2 of the t compiler) and you can define up to a maximum of 32 environment variables. Unlike ordinary variables, environment variables cannot be initialized or accessed directly in the t program. Instead, they are accessed using envvarSetValue() and envvarGetValue().[/vc_column_text][vc_code_raket header="Setting an environment variable" code="dm9pZCUyMHNldEhvc3RJZENvbm5lY3RlZCUyMCUyOGludCUyMHZhbHVlJTI5JTBBJTdCJTBBJTIwJTIwaG9zdElkQ29ubmVjdGVkJTIwJTNEJTIwdmFsdWUlM0IlMEElMjAlMjBlbnZ2YXJTZXRWYWx1ZSUyOEhvc3RJZENvbm5lY3RlZCUyQyUyMHZhbHVlJTI5JTNCJTBBJTdE"][vc_column_text]The function envvarSetValue() will set the value of the environment variable. The actual update will be queued and therefore delayed until the execution of the current hook has finished. A notification that the environment variable has been updated is then propagated to all programs that have declared the same environment variable and have a corresponding on envvar hook. In this context, updated includes the setting of the same value as before. Since the actual update of the environment variable is delayed, it is possible to initiate a new update of the same environment variable during this delay. In this case, the older value is lost. So every time you read an environment variable you get its latest value and if you want to make sure that every change is seen, you need to implement a hand shaking scheme using at least two environment variables.[/vc_column_text][vc_code_raket header="The on envvar hook" code="JTJGJTJGJTIwUHJpbnQlMjBpbmNvbWluZyUyMG1lc3NhZ2VzJTBBb24lMjBlbnZ2YXIlMjBNZXNzYWdlJTIwJTdCJTBBJTIwJTIwY2hhciUyMG1zZyU1QjEyOCU1RCUzQiUwQSUyMCUyMGludCUyMHNldmVyaXR5JTNCJTBBJTIwJTIwZW52dmFyR2V0VmFsdWUlMjhNZXNzYWdlJTJDJTIwbXNnJTI5JTNCJTBBJTIwJTIwZW52dmFyR2V0VmFsdWUlMjhTZXZlcml0eSUyQyUyMCUyNnNldmVyaXR5JTI5JTNCJTBBJTIwJTIwcHJpbnRmJTI4JTIyU2V2ZXJpdHklM0ElMjAlMjVkJTIwLSUyMCUyNXMlNUNuJTIyJTJDJTIwc2V2ZXJpdHklMkMlMjBtc2clMjklM0IlMEElN0Q="][vc_column_text]The function envvarGetValue() retrieves the last known value of the environment variable. The result is undefined if the environment variable is not initialized. Full program listings are available on http://github.com/Kvaser/developer-blog. The next post in this series will show how to access the environment variable in CANlib.[/vc_column_text][vc_column_text]

Footnotes:

1 The Kvaser t Programming Language documentation is available from https://www.kvaser.com/download/#?filter=t%20programming.[/vc_column_text][/vc_column][/vc_row] [post_title] => Introduction to Environment Variables (1 of 3) [post_excerpt] => [post_status] => publish [comment_status] => closed [ping_status] => closed [post_password] => [post_name] => introduction-to-environment-variables-1-of-3 [to_ping] => [pinged] => [post_modified] => 2022-10-04 13:25:17 [post_modified_gmt] => 2022-10-04 13:25:17 [post_content_filtered] => [post_parent] => 0 [guid] => https://www.kvaser.com/?post_type=developer_blog&p=39871 [menu_order] => 0 [post_type] => developer_blog [post_mime_type] => [comment_count] => 0 [filter] => raw ) [1] => WP_Post Object ( [ID] => 6124 [post_author] => 5 [post_date] => 2015-08-19 14:03:37 [post_date_gmt] => 2015-08-19 14:03:37 [post_content] => [vc_row][vc_column][vc_column_text]Kvaser is participating in CAN FD Tech Day China, which takes place on 9th September 2014 in Shanghai. Organised by CAN in Automation (CiA) international users’ and manufacturers’ group, the event will provide an overview on the status of CAN FD developments and discussions, plus an opportunity to view several CAN FD demonstrators. Kent Lennartsson, Kvaser’s Hardware Development Manager will present a paper entitled ‘Physical layer diagnostics with CAN FD’, plus Kvaser’s own CAN FD demonstrator will be available to view.[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column width="5/6"][vc_header_raket header_type="h4" header="Related articles:"][vc_raket_news size="regular" post_id="5900"][vc_raket_news size="regular" post_id="1583"][vc_raket_news size="regular" post_id="1894"][/vc_column][vc_column width="1/6"][/vc_column][/vc_row] [post_title] => Kvaser to participate in CAN FD Tech Day in Shanghai, China [post_excerpt] => The latest incarnation of the Controller Area Network (CAN), CAN with Flexible Data-Rate (CAN FD)**, has now reached Committee Draft status. [post_status] => publish [comment_status] => open [ping_status] => open [post_password] => [post_name] => kvaser-to-participate-in-can-fd-tech-day-china [to_ping] => [pinged] => [post_modified] => 2022-09-29 04:14:33 [post_modified_gmt] => 2022-09-29 04:14:33 [post_content_filtered] => [post_parent] => 0 [guid] => https://www.kvaser.com/?p=6124 [menu_order] => 0 [post_type] => post [post_mime_type] => [comment_count] => 0 [filter] => raw ) [2] => WP_Post Object ( [ID] => 39872 [post_author] => 14 [post_date] => 2015-07-08 13:25:29 [post_date_gmt] => 2015-07-08 13:25:29 [post_content] => [vc_row][vc_column][vc_video link="http://www.youtube.com/watch?v=WXMtLztbim8"][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]

This is the first post in a 3-part series about CANlib development:
  1. Setting up CANlib in Visual Studio
  2. Basic API Calls
  3. Event Driven Applications

Intro

Welcome to our guide on how to setup a Visual Studio C# project to use the Kvaser CANlib Software Development Kit.

Before beginning please make sure that you’ve installed CANlib and our latest drivers. In addition to the Visual Studio C# tools, you will need to install the Microsoft Visual C++ redistributable package. This package is necessary because the managed CANlib Dynamic Link Libraries are created using C++.

Example

For our example we are going to create a Windows C# console application. To do this, we will launch the New Project wizard by selecting the New Project link from the Start Page. Once the wizard is open, select Windows Desktop under Visual C#, in the Templates tree. Select Console Application from the template list. You may also choose your desired .NET framework from the drop menu above the available templates list. We need to create an application name and select a location for the project to be saved. Finally, press OK and Visual Studio will create the solution directory and associated project files.

Once the project has opened, right click on the project file in the Solution Explorer. Select Properties, then under the Application tab, make sure that the Target Framework has the desired Framework version.  Next we move to the Build tab to set the Platform Target. First change the Configuration to “All Configurations,” then select the desired Platform Target. The Platform Target cannot be set to Any CPU. The CANlib Dynamic Link Libraries are created using C++ which requires a specific target platform. Therefore, you must select a Platform target for your project of x86 or x64. For this example, we will choose x64.

[/vc_column_text][vc_single_image image="7849" img_size="full"][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]

Save these settings, and then right click on References in the Solution Explorer. Select “Add Reference,” and then browse to select the CANlib DLL file that matches your project’s target platform and framework. In the CANlib installation directory these files are sorted into different subdirectories by Target Platform followed by Framework version. First we will need to browse for dotnet in the CANlib installation directory. Since we chose to work with the 4.5.1 Framework and x64 in this example, we will select the x64 folder and then select fw40 to see the available CANlib DLLs that are compatible with our project. For this project, we are working with communication on a Kvaser CAN interface, so we will choose canlibCLSNET.dll. Once a selection has been made, it should appear under References in the Solution Explorer.

We are now ready to add code that uses the CANlib API. To prove that the project is setup correctly, we will add the first couple of necessary lines to access the functions in the canlibCLSNET.dll. We first add the canlibCLSNET namespace to the project with the “using” directive. Then in the main routine we will add a call to the canInitializeLibrary function. Now we can try building the project. Since the project builds without errors, we can make sure all of the runtime components are present by running the project. Our example was able to launch without any runtime exceptions so we know our libraries have been successfully linked to the project.

More Info

For more information about CANlib, you can view our CANlib SDK Help and check out our series of developer blogs.

[/vc_column_text][/vc_column][/vc_row] [post_title] => Setting Up CANlib for Visual Studio [post_excerpt] => [post_status] => publish [comment_status] => closed [ping_status] => closed [post_password] => [post_name] => setting-up-canlib-for-visual-studio [to_ping] => [pinged] => [post_modified] => 2022-10-04 13:28:08 [post_modified_gmt] => 2022-10-04 13:28:08 [post_content_filtered] => [post_parent] => 0 [guid] => https://www.kvaser.com/?post_type=developer_blog&p=39872 [menu_order] => 0 [post_type] => developer_blog [post_mime_type] => [comment_count] => 0 [filter] => raw ) [3] => WP_Post Object ( [ID] => 7712 [post_author] => 5 [post_date] => 2015-06-04 03:50:04 [post_date_gmt] => 2015-06-04 03:50:04 [post_content] => [vc_row][vc_column][vc_column_text]00683-6_PCIEcan_4xHS Kvaser AB has introduced the Kvaser PCIEcan 4xHS, a highly integrated, high speed controller area network (CAN) network card that adds four high speed CAN channels to any standard computer board with PCI Express capability. Offering silent mode, error frame detection/generation and an on-board buffer, this small form factor add-on board fits many embedded data acquisition systems and is CAN-FD ready.
Commented Lars-Berno Fredriksson, president of Kvaser AB: “The Kvaser PCIEcan 4xHS is by far our fastest network card ever. With an in-house developed CAN-controller, implemented in an FPGA, no compromises have been made in terms of message speed.”
The Kvaser PCIEcan 4xHS has an average response time of 45 µs. An onboard buffer ensures that there is no risk of the card ‘dropping’ messages, meaning that the Kvaser PCIEcan 4xHS is as robust as it is responsive. This is very useful in 'ping-pong protocols' such as firmware updates. This is a low profile card (86 x 69mm) that is fully compatible with J1939, CANopen, NMEA 2000 and DeviceNet. With a wide operating temperature of 0oC to +85oC and galvanically isolated CAN bus drivers, it is designed for standard and industrial computers alike. Kvaser’s PCIEcan boards are supported by device drivers and program examples for Windows and Linux. All Kvaser CAN interface boards share a common software API, Kvaser CANLIB, that is free to download. Kvaser CanKing, a general purpose interactive CAN bus monitor, can also be download free of charge from our web site.       About Kvaser: With 30 years of CAN development experience and more than 60 CAN-to-PC related products to its name, Kvaser AB (www.kvaser.com) is the CAN expert, bringing its deep knowledge in the field of CAN to industries that include Automotive, Avionics, Building Automation, Domestic Appliances, Hydraulic Equipment, Industrial Automation, Maritime, Medical, Military, Railway, Telecoms and Textiles. A powerful and easy to use API that is common to all Kvaser interfaces has made Kvaser products popular among systems, as well as tool designers. Meanwhile, end users value Kvaser’s high quality, reliability and comprehensive third party support. OEM versions of Kvaser products are also available, making a cost efficient alternative to in-house development for many companies. Kvaser is headquartered in Mölndal, Sweden, with regional offices in Mission Viejo, CA in the United States, and in Shanghai, China. Kvaser AB also has a global network of highly knowledgeable Qualified Sales Representatives and Technical Associates. To find the nearest Kvaser supplier to you, please visit www.kvaser.com [/vc_column_text][/vc_column][/vc_row] [post_title] => Kvaser launches four channel PCI Express to CAN card that is our fastest yet [post_excerpt] => Kvaser has introduced a high speed CAN network card that adds four high speed CAN channels to any standard computer board with PCI Express capability. [post_status] => publish [comment_status] => closed [ping_status] => closed [post_password] => [post_name] => kvaser-launches-four-channel-pci-express-to-can-card-that-is-our-fastest-yet [to_ping] => [pinged] => [post_modified] => 2022-09-29 04:14:13 [post_modified_gmt] => 2022-09-29 04:14:13 [post_content_filtered] => [post_parent] => 0 [guid] => https://www.kvaser.com/?p=7712 [menu_order] => 0 [post_type] => post [post_mime_type] => [comment_count] => 0 [filter] => raw ) [4] => WP_Post Object ( [ID] => 39873 [post_author] => 14 [post_date] => 2015-06-03 13:28:58 [post_date_gmt] => 2015-06-03 13:28:58 [post_content] => [vc_row][vc_column width="1/1"][vc_column_text]When writing "Was that the CANlib channel number or Card Number?", I got a comment asking for clarification about the difference between the CanHandle and channel number since they can both start at zero. A CAN channel is opened using the function canOpenChannel() in CANlib, passing the channel number as the first argument.[/vc_column_text][vc_code_raket language="c" code="Q2FuSGFuZGxlJTIwaGFuZGxlJTNCJTBBY2FuU3RhdHVzJTIwc3RhdCUzQiUwQSUwQWludCUyMGNhbkxpYkNoYW5uZWxOdW1iZXIlMjAlM0QlMjAwJTNCJTBBJTBBaGFuZGxlJTIwJTNEJTIwY2FuT3BlbkNoYW5uZWwlMjhjYW5MaWJDaGFubmVsTnVtYmVyJTJDJTIwY2FuT1BFTl9BQ0NFUFRfVklSVFVBTCUyOSUzQiUwQWlmJTIwJTI4aGFuZGxlJTIwJTNDJTIwMCUyOSUyMCU3QiUwQSUyMCUyMHByaW50ZiUyOCUyMmNhbk9wZW5DaGFubmVsJTIwZmFpbGVkJTJDJTIwc3RhdHVzJTNEJTI1ZCU1Q24lMjIlMkMlMjBzdGF0JTI5JTNCJTBBJTdE"][vc_column_text]This will return a handle that can be any non-negative number (and it is often zero the first time you call it). The handle is used later e.g. when reading the next available CAN messages. If the call to canOpenChannel() fails, a negative error code will be returned instead of the valid handle.[/vc_column_text][vc_code_raket language="c" code="bG9uZyUyMGlkJTNCJTBBdW5zaWduZWQlMjBjaGFyJTIwZGF0YSU1QjglNUQlM0IlMEF1bnNpZ25lZCUyMGludCUyMGRsYyUyQyUyMGZsYWdzJTNCJTBBdW5zaWduZWQlMjBsb25nJTIwdGltZXN0YW1wJTNCJTBBJTBBc3RhdCUyMCUzRCUyMGNhblJlYWQlMjhoYW5kbGUlMkMlMjAlMjZpZCUyQyUyMGRhdGElMkMlMjAlMjZkbGMlMkMlMjAlMjZmbGFncyUyQyUyMCUyNnRpbWVzdGFtcCUyOSUzQiUwQWlmJTIwJTI4c3RhdCUyMCUyMSUzRCUyMGNhbkVSUl9OT01TRyUyOSUyMCU3QiUwQSUyMCUyMHByaW50ZiUyOCUyMkZhaWxlZCUyQyUyMHN0YXR1cyUyMCUzRCUzRCUyMCUyNWQlNUNuJTIyJTJDJTIwc3RhdCUyOSUzQiUwQSU3RA=="][vc_column_text]The handle is an internal positive number that should never be edited manually. As mentioned, the CanHandle returned in CANlib could be mixed up with the channel number but later libraries, such as kvrlib, returns a much larger, more random, number in order to minimize the risk of confusion. I suggest to get into the habit of always declaring the handle as a CanHandle (instead of int) and thereby clearly marking it a handle. While making suggestions, may I also encourage you to always check the return status as we did on canRead() above? This will shorten the debug time when things start to fail...[/vc_column_text][/vc_column][/vc_row] [post_title] => The CAN handle vs channel number [post_excerpt] => [post_status] => publish [comment_status] => closed [ping_status] => closed [post_password] => [post_name] => can-handle-vs-channel-number [to_ping] => [pinged] => [post_modified] => 2022-10-04 13:30:07 [post_modified_gmt] => 2022-10-04 13:30:07 [post_content_filtered] => [post_parent] => 0 [guid] => https://www.kvaser.com/?post_type=developer_blog&p=39873 [menu_order] => 0 [post_type] => developer_blog [post_mime_type] => [comment_count] => 0 [filter] => raw ) [5] => WP_Post Object ( [ID] => 39874 [post_author] => 14 [post_date] => 2015-05-29 13:31:54 [post_date_gmt] => 2015-05-29 13:31:54 [post_content] => [vc_row][vc_column][vc_message]This blog uses now deprecated functions, see blog "Improved API in Python canlib v1.5" for more information.[/vc_message][vc_column_text]Today we take a look at how to read logged data and how to relate the data to our watch using kvmlib. We do this by recording some sample data and then try and analyze it using the Python wrapper.

1.1 Generate and record the data.

Let us begin by generating some data. We use the t sample program histogram_stimuli.t, which is included in the CANlib SDK (Samples\tScript\histogram\histogram_stimuli.t). This t program uses four messages; ECM_001, ECM_003, ECM_004 and LIM_002. These messages contains the signals EngineSpeed, EngineTemp, Fuel and Load.
Table 1: Used signals and their main attributes
Signal Name Type Min Max Unit Message Name CAN Id
EngineSpeed Unsigned 0 6000 rpm ECM_001 501
EngineTemp Float -60 200 °C ECM_003 503
Fuel Float 0 300 l/100 km ECM_004 504
Load Float 0 100 metric ton LIM_002 402
The t program generates random values and delays between messages (within the ranges set up in init_stimuli_ctrl()). Now configure an Eagle to "Log everything", start the t program and let it record for a few minutes.
[/vc_column_text][vc_column_text]

1.2 When was the engine temperature at about 161°C?

The first question we would like to answer is "When was the engine temperature at 161°C?". (This is perhaps not the most engineering-like question in the real world, but since our data is completely random I believe it is good enough to visualize how we get the absolute time when reading the log file.)If we had known the question from the beginning, we could have added a couple of triggers that would have started logging whenever the engine temperature was between say 159°C to 163°C (and stopped logging when it was outside this range). But now let us read out all logged data and print out when engine temperature was between 159°C and 163°C.Before running the program 1 let us go through the main parts. We start by defining a function that finds the device we would like to talk to and open it to get some handles.[/vc_column_text][vc_code_raket language="python" code="ZGVmJTIwcmVhZEV2ZW50c0Zyb21EZXZpY2UlMjhlYW4lMkMlMjBjaGFubmVsJTJDJTIwbXNnSWQlMjklM0ElMEElMjMlMjBSZWFkJTIwYWxsJTIwZXZlbnRzJTIwZnJvbSUyMGRldmljZSUyMG1hdGNoaW5nJTIwZWFuJTJDJTIwY2hhbm5lbCUyMGFuZCUyMG1zZ0lkJTBBcHJpbnQlMjAlMjJPcGVuJTIwZGV2aWNlLi4uJTIyJTBBJTIzJTIwQ3JlYXRlJTIwYSUyMGRldmljZSUyMHdpdGglMjB0aGUlMjBzZWxlY3RlZCUyMEVBTiUyMG51bWJlciUwQWRldiUyMCUzRCUyMGt2RGV2aWNlLmt2RGV2aWNlJTI4ZWFuJTNEZWFuJTI5JTBBJTIzJTIwT3BlbiUyMGElMjBkZXZpY2UlMjB0aGF0JTIwbWF0Y2hlcyUyMG91ciUyMGNyaXRlcmlhJTIwJTI4RUFOJTI5JTBBZGV2Lm1lbW9PcGVuJTI4JTI5JTBBJTIzJTIwTW91bnQlMjB0aGUlMjBsb2clMjBmaWxlcyUyMHNvJTIwd2UlMjBjYW4lMjBhY2NlcyUyMHRoZW0lMEFkZXYubWVtby5kZXZpY2VNb3VudEttZiUyOCUyOSUwQSUyMyUyMFJlYWQlMjBvdXQlMjBob3clMjBtYW55JTIwbG9nJTIwZmlsZXMlMjB0aGF0JTIwYXJlJTIwYXZhaWxpYmxlJTIwb24lMjB0aGUlMjBjYXJkJTBBZmlsZUNvdW50JTIwJTNEJTIwZGV2Lm1lbW8ubG9nRmlsZUdldENvdW50JTI4JTI5JTBBcHJpbnQlMjAlMjJGb3VuZCUyMCUyNWQlMjBmaWxlJTI1cyUyMG9uJTIwY2FyZCUzQSUyMiUyMCUyNSUyMCUyOGZpbGVDb3VudCUyQyUyMCUyMnMlMjIlMjBpZiUyMGZpbGVDb3VudCUyMCUzRSUyMDElMjBlbHNlJTIwJTIyJTIyJTI5"][vc_column_text]
As can be seen in the above code snippet, we first define our device using the kvDevice helper module and open a handle to it. Then we open a kvmhandle to the device (using memoOpen()) before we get hold of the log files on the device with deviceMountKmf(). We then read out the number of log files that reside on the card.2
[/vc_column_text][vc_code_raket language="python" code="JTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIzJTIwTm93JTIwd2UlMjByZWFkJTIwYWxsJTIwZXZlbnRzJTIwZnJvbSUyMGVhY2glMjBmaWxlJTIwZm91bmQlMjBvbiUyMHRoZSUyMGNhcmQuJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwZm9yJTIwZmlsZUluZHglMjBpbiUyMHJhbmdlJTIwJTI4ZmlsZUNvdW50JTI5JTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIzJTIwV2hlbiUyMG1vdW50aW5nJTIwdGhlJTIwbG9nZmlsZSUyQyUyMHdlJTIwZ2V0JTIwYW4lMjBhcHJveGltYXRlJTIwdmFsdWUlMjBiYWNrJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZXZlbnRDb3VudCUyMCUzRCUyMGRldi5tZW1vLmxvZ0ZpbGVNb3VudCUyOGZpbGVJbmR4JTI5JTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcHJpbnQlMjAlMjJGaWxlJTIwJTI1M2QlM0ElMjBDb250YWlucyUyMGxlc3MlMjB0aGFuJTIwJTI1ZCUyMGV2ZW50cyUyMiUyMCUyNSUyMCUyOGZpbGVJbmR4JTJDJTIwZXZlbnRDb3VudCUyOSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMyUyMFdlJTIwcmVhZCUyMG91dCUyMHdoZW4lMjB0aGUlMjBsb2dnaW5nJTIwd2FzJTIwc3RhcnRlZCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHN0YXJ0VGltZSUyMCUzRCUyMGRldi5tZW1vLmxvZ0ZpbGVHZXRTdGFydFRpbWUlMjglMjklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBwcmludCUyMCUyMkxvZ2dpbmclMjBzdGFydGVkJTIwYXQlMjAlMjVzJTVDbiUyMiUyMCUyNSUyMHN0YXJ0VGltZQ=="][vc_column_text] We loop through each log file and mount it.3 Mounting a log file also returns an event count which holds "The approximate number of events in the log file".4 We then read out the time the log file was started, remembering this for later.</
[/vc_column_text][vc_code_raket language="python" code="JTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwd2hpbGUlMjBUcnVlJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIzJTIwUmVhZCUyMGV2ZW50cyUyMGZyb20lMjB0aGUlMjBsb2clMjBmaWxlJTJDJTIwd2hlbiUyMG5vJTIwbW9yZSUyMGV2ZW50cyUyMGFyZSUyMGF2YWlsaWJsZSUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMyUyMCUyN05vbmUlMjclMjB3aWxsJTIwYmUlMjByZXR1cm5lZCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGV2ZW50JTIwJTNEJTIwZGV2Lm1lbW8ubG9nUmVhZEV2ZW50RXglMjglMjklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBpZiUyMGV2ZW50JTIwaXMlMjBOb25lJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwYnJlYWs="][vc_column_text]We now read out the events one by one in a loop until no more events are available.[/vc_column_text][vc_code_raket language="python" code="JTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIzJTIwV2UlMjBhcmUlMjBvbmx5JTIwaW50ZXJlc3RlZCUyMGluJTIwZXZlbnRzJTIwdGhhdCUyMGFyZSUyMGxvZyUyMG1lc3NhZ2VzJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwaWYlMjB0eXBlJTI4ZXZlbnQlMjklMjBpcyUyMGt2bWxpYi5sb2dNc2clM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjMlMjBBbHNvJTIwZmlsdGVyJTIwb24lMjBtZXNzYWdlJTIwaWQlMjBhbmQlMjBjaGFubmVsJTIwbnVtYmVyJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwaWYlMjBldmVudC5pZCUyMCUzRCUzRCUyMG1zZ0lkJTIwYW5kJTIwZXZlbnQuY2hhbm5lbCUyMCUzRCUzRCUyMGNoYW5uZWwlM0E="][vc_column_text]Since we are only interested in one type of log messages we filter those out.5 We also filter out the channel number on the card we are interested in.6[/vc_column_text][vc_code_raket language="python" code="JTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIzJTIwV2UlMjBrbm93JTIwdGhlJTIwbWVzc2FnZSUyMGRhdGElMjBpcyUyMGElMjBmbG9hdCUyQyUyMHNvJTIwY29udmVydCUyMGl0JTIwdG8lMjBhJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIzJTIwbW9yZSUyMHVzYWJsZSUyMGZvcm1hdCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHZhbHVlJTIwJTNEJTIwcmF3MmZsb2F0JTI4ZXZlbnQuZGF0YSUyOSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMyUyME5vdyUyMGZpbHRlciUyMG9uJTIwdGhlJTIwdmFsdWUlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBpZiUyMHZhbHVlJTIwJTNFJTIwMTU5JTIwYW5kJTIwdmFsdWUlMjAlM0MlMjAxNjMlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjMlMjBHZXQlMjB0aGUlMjB0aW1lJTIwb2YlMjB0aGUlMjBldmVudCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGV2ZW50VGltZSUyMCUzRCUyMGdldEV2ZW50VGltZSUyOHN0YXJ0VGltZSUyQyUyMGV2ZW50JTI5JTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcHJpbnQlMjAlMjIlMjVzJTJDJTIwTXNnJTIwaWQlMjAlMjVkJTIwdmFsdWUlMjAlMjVmJTIwb24lMjBjaGFubmVsJTIwJTI1ZCUzQSUyMiUyMCUyNSUyMCUyOGV2ZW50VGltZSUyQyUyMG1zZ0lkJTJDJTIwdmFsdWUlMkMlMjBjaGFubmVsJTI5JTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIzcHJpbnQlMjBldmVudA=="][vc_column_text]We convert the raw value to a float in the function raw2float(). Looking at the database we see that this is a straight forward mapping (type float, format Intel, start bit 0, length 32, factor 1 offset 0). If the value was between 159 and 163, we calculate the absolute time of the event in the function getEventTime() and finally print out the data.[/vc_column_text][vc_code_raket language="python" code="JTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcHJpbnQlMjAlMjJuJTIyJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIzJTIwRGlzbW91bnQlMjB0byUyMGZyZWUlMjB1cCUyMHJlc291cmNlcyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGRldi5tZW1vLmxvZ0ZpbGVEaXNtb3VudCUyOCUyOSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMyUyMFdlJTIwYXJlJTIwZG9uZSUyQyUyMGNsb3NlJTIwdGhlJTIwa3ZtbGliJTIwaGFuZGxlJTIwdG8lMjBkZXZpY2UlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjBkZXYubWVtb0Nsb3NlJTI4JTI5"][vc_column_text]When all events have been read, we dismount the log file and continue with the next. After all log files have been read, we close the handle to the device. The absolute time of the event is calculated in the function getEventTime() by adding the start time of the log file to the time stamp of the event.[/vc_column_text][vc_code_raket language="python" code="JTIwJTIwJTIwZGVmJTIwZ2V0RXZlbnRUaW1lJTI4c3RhcnRUaW1lJTJDJTIwZXZlbnQlMjklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjMlMjBUaGUlMjBldmVudCUyMHRpbWVzdGFtcCUyMGlzJTIwZ2l2ZW4lMjBpbiUyMG5hbm9zZWNvbmRzLiUyMFRoaXMlMjBmdW5jdGlvbiUyMGNvbnZlcnRzJTIwaXQlMjB0byUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMyUyMHNlY29uZHMlMkMlMjBhbmQlMjByZXR1cm5zJTIwdGhlJTIwc3VtJTIwb2YlMjBzdGFydFRpbWUlMjBhbmQlMjBldmVudCUyMHRpbWUlMjAlMjhhcyUyMGElMjBQeXRob24lMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjMlMjBkYXRldGltZSUyMG9iamVjdCUyOS4lMEElMjAlMjAlMjAlMjAlMjAlMjAlMjBvZmZzZXRJblNlY29uZHMlMjAlM0QlMjBldmVudC50aW1lU3RhbXAlMkYxMDAwMDAwMDAwLjAlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjBzdGFydFRpbWUlMjAlMkIlMjBkYXRldGltZS50aW1lZGVsdGElMjhzZWNvbmRzJTNEb2Zmc2V0SW5TZWNvbmRzJTI5"][vc_column_text]Note that the time stamp is given in nanoseconds so we need to convert it to seconds before using the Python datetime package to add it to the start time of the log file.[/vc_column_text][vc_code_raket language="python" code="JTIwJTIwJTIwJTIzJTIwUmVhZCUyMGFsbCUyMGV2ZW50cyUyMHdpdGglMjBtZXNzYWdlJTIwaWQlMjA1MDMlMkMlMjBvbiUyMHRoZSUyMGZpcnN0JTIwY2hhbm5lbCUyQyUyMGZyb20lMjB0aGUlMjBmaXJzdCUwQSUyMCUyMCUyMCUyMyUyMGRldmljZSUyMHdpdGglMjBFQU4lMjA3My0zMDEzMC0wMDU2Ny05LiUwQSUyMCUyMCUyMHJlYWRFdmVudHNGcm9tRGV2aWNlJTI4ZWFuJTNEJTIyNzMtMzAxMzAtMDA1NjctOSUyMiUyQyUyMGNoYW5uZWwlM0QwJTJDJTIwbXNnSWQlM0Q1MDMlMjk="][vc_column_text]Calling our function as shown in the above code results in the following output:[/vc_column_text][vc_code_raket code="T3BlbiUyMGRldmljZS4uLiUwQUZvdW5kJTIwMSUyMGZpbGUlMjBvbiUyMGNhcmQlM0ElMEElMEFGaWxlJTIwJTIwJTIwMCUzQSUyMENvbnRhaW5zJTIwbGVzcyUyMHRoYW4lMjA5NjAlMjBldmVudHMlMEFMb2dnaW5nJTIwc3RhcnRlZCUyMGF0JTIwMjAxNS0wNS0xNyUyMDEyJTNBNDglM0EyNiUwQSUwQTIwMTUtMDUtMTclMjAxMiUzQTQ5JTNBMDcuNTEwMjM0JTJDJTIwTXNnJTIwaWQlMjA1MDMlMjB2YWx1ZSUyMDE2MC40MTg1MTglMjBvbiUyMGNoYW5uZWwlMjAwJTNBJTBBMjAxNS0wNS0xNyUyMDEyJTNBNDklM0EzOS42NDczNjglMkMlMjBNc2clMjBpZCUyMDUwMyUyMHZhbHVlJTIwMTU5Ljc1MDU5NSUyMG9uJTIwY2hhbm5lbCUyMDAlM0ElMEEyMDE1LTA1LTE3JTIwMTIlM0E0OSUzQTQ0LjY0MjM4MCUyQyUyME1zZyUyMGlkJTIwNTAzJTIwdmFsdWUlMjAxNjEuODE4MjY4JTIwb24lMjBjaGFubmVsJTIwMCUzQSUwQTIwMTUtMDUtMTclMjAxMiUzQTQ5JTNBNTkuNzUzNDQwJTJDJTIwTXNnJTIwaWQlMjA1MDMlMjB2YWx1ZSUyMDE2MC40NzcwMzYlMjBvbiUyMGNoYW5uZWwlMjAwJTNBJTBBMjAxNS0wNS0xNyUyMDEyJTNBNTAlM0ExMC40MzM0OTAlMkMlMjBNc2clMjBpZCUyMDUwMyUyMHZhbHVlJTIwMTYyLjM4OTI2NyUyMG9uJTIwY2hhbm5lbCUyMDAlM0ElMEEyMDE1LTA1LTE3JTIwMTIlM0E1MCUzQTE2LjY4NDUyMiUyQyUyME1zZyUyMGlkJTIwNTAzJTIwdmFsdWUlMjAxNTkuMzc3NTc5JTIwb24lMjBjaGFubmVsJTIwMCUzQSUwQTIwMTUtMDUtMTclMjAxMiUzQTUwJTNBNTMuNDExNjc1JTJDJTIwTXNnJTIwaWQlMjA1MDMlMjB2YWx1ZSUyMDE2MC43NDg5NDclMjBvbiUyMGNoYW5uZWwlMjAwJTNBJTBBMjAxNS0wNS0xNyUyMDEyJTNBNTElM0EwMC45NjE3MDYlMkMlMjBNc2clMjBpZCUyMDUwMyUyMHZhbHVlJTIwMTU5LjI4Mjg2NyUyMG9uJTIwY2hhbm5lbCUyMDAlM0E="][vc_column_text]
In the printout, we can see that 160.477°C have been noted at 2015-05-17 12:49:59.753440. Another way, if we do not have too much data, is to extract to .csv and sort the columns to find the correct values. Let us do this now since this will give us some more insight in the realm of time…
  1. Connect your Memorator to the PC.
  2. Start the appropriate Kvaser Memorator Config Tool (e.g. use the Eagle shortcut) and connect to your device.
  3. Go to the tab Log files.
  4. Click "List files" to refresh the list.
  5. Click "Extract files…".
  6. Set file destination and file name options, click "Next".
  7. Set the format of the extracted files to "Selected signals in CSV format", click "Next".
  8. Click Add Database and select histogram.dbc (found in SamplestScript histogramhistogram.dbc).
  9. Double click on the signal "EngineTemp", click Next.
  10. Make sure that "Time stamp offset" is set to "Start of measurement" and that "High resolution AbsTime" is checked (under CSV file options, see Figure 1). If you, like me, have a non-English version of MS Excel, adjust the "Separator character" (;) and "Decimal separator" (,) as appropriate so the spread sheet program picks up the values as numbers (and not text). Click Finish.
Figure 1: Last step of the extraction wizard in the Kvaser Memorator Config Tool.
Open up the exported .csv in a spread sheet program, sort on the column containing EngineTemp and scroll down to when the EngineTemp was reported as 160°C, see Figure 2. Reading the AbsTime column we can now see that the EngineTemp was e.g. 160.477°C at 2015-05-17T11:49:59.6651.
Figure 2: A part of the resulting .csv file after extracting with "High resolution AbsTime" enabled.
But hey, didn't our Python program say "12:49:59.753440"? Yes, great spotted, that is correct. First, the hour between 11:49 and 12:49 is due to Unix time vs local time. Unix time is "the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970".7 This means that both time zones and daylight saving times should be considered when doing the conversion from Unix time to local time. The real time clock in the Memorator is set in Unix time and Python is trying to be nice to us and serve the time as local time. The .csv sheet is also in UTC time but no-one told that to the spreadsheet program and hence the one hour difference. So what about the remaining 883 ms difference? This is due to time stamp offset. Let us look at the first raw values in our file by extracting to "CAN frames in plain text format" and set "Time stamp offset" to "Start of measurement". We now get the following:
[/vc_column_text][vc_code_raket code="JTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwS3Zhc2VyJTIwTWVtb3JhdG9yJTIwTG9n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yMCUyMDIlMEElMjAlMjAlMjAlMjAlMjAxOCUyQzUxNjEyOSUyMCUyMDElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjA1MDMlMjAlMjAlMjAlMjBSeCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMDglMjAlMjAyMDYlMjAyMDglMjAlMjAlMjAyJTIwJTIwNjclMjAlMjAlMjAwJTIwJTIwJTIwMCUyMCUyMCUyMDAlMjAlMjAlMjAwJTIwJTIwJTIwJTIwJTIwMyUwQSUyMCUyMCUyMCUyMCUyMDE4JTJDNTI5MTI5JTIwJTIwMSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMDUwMyUyMCUyMCUyMCUyMFJ4JTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwOCUyMCUyMCUyMDYwJTIwMTg0JTIwMjU0JTIwJTIwNjYlMjAlMjAlMjAwJTIwJTIwJTIwMCUyMCUyMCUyMDAlMjAlMjAlMjAwJTIwJTIwJTIwJTIwJTIwNA=="][vc_column_text]
Note that the first Trigger event arrives after 883 ms. Now, compensate for this by once again extracting to "CAN frames in plain text format" and set "Time stamp offset" to "First trigger". We now get the following:
[/vc_column_text][vc_code_raket code="JTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwS3Zhc2VyJTIwTWVtb3JhdG9yJTIwTG9nJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTNEJTNEJTNEJTNEJTNEJTNEJTNEJTNEJTNEJTNEJTNEJTNEJTNEJTNEJTNEJTNEJTNEJTNEJTNEJTNEJTBBJTBBJTIwJTIwQ29udmVyd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wMCUyMCUyMCUyMCUyMCUyMDMlMEElMjAlMjAlMjAlMjAlMjAxOCUyQzQ0MDg0NSUyMCUyMDElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjA1MDMlMjAlMjAlMjAlMjBSeCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMDglMjAlMjAlMjA2MCUyMDE4NCUyMDI1NCUyMCUyMDY2JTIwJTIwJTIwMCUyMCUyMCUyMDAlMjAlMjAlMjAwJTIwJTIwJTIwMCUyMCUyMCUyMCUyMCUyMDQ="][vc_column_text]
Now we have a "Timestamp Offset" of -883 ms and all our time stamps have been adjusted by this amount. So why did we not compensate for this in the Python program? The real time clock have an accuracy of 2 s (±1 s) so it would really be overkill to compensate for some tenths of a second in this case.  

1.3 What were the values at 12:49:15?

Let us assume that someone said that "the driver noted a sound when his clock showed 12:49:15, what were the values of the EngineTemp at that time?" Yet again, if we had known that the driver needed to mark something, we would have given him a button to press. This button would have been connected to the trigger input of the Memorator, as shown in Figure 2, and given us an easy to find trigger whenever pressed.
Figure 3: Example of how to connect a push button to the External trigger input of the Memorator.
Before we dive into the log file, we must think about the time the driver noted, 12:49:15. Since he said he looked at the clock, this is in local time and knowing that the Python kvmlib wrapper converts the time stamp into local time, let us write a small program to output relevant data. We also know that the accuracy is 2 s, so let us look at the interval 12:49:10 - 12:49:20. The program is very much as before, except that we filter on time stamp instead of on the recorded value.
[/vc_column_text][vc_code_raket code="JTIwJTIwJTIwJTIzJTIwRmlsdGVyJTIwb3V0JTIwbG9nJTIwbWVzc2FnZXMlMjB0aGF0JTIwYXJlJTIwb3V0c2lkZSUyMG9mJTIwb3VyJTIwdGltZSUyMHJhbmdlJTBBJTIwJTIwJTIwdGltZSUyMCUzRCUyMHN0YXJ0VGltZSUyMCUyQiUyMGRhdGV0aW1lLnRpbWVkZWx0YSUyOHNlY29uZHMlM0RldmVudC50aW1lU3RhbXAlMkYxMDAwMDAwMDAwLjAlMjklMEElMjAlMjAlMjBpZiUy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TAzJTIwdmFsdWUlMjAzNi43MTMyMjYlMjBvbiUyMGNoYW5uZWwlMjAwJTNBJTBBMjAxNS0wNS0xNyUyMDEyJTNBNDklM0ExOC41NDMyNzAlMkMlMjBNc2clMjBpZCUyMDUwMyUyMHZhbHVlJTIwLTQxLjU5ODY0OCUyMG9uJTIwY2hhbm5lbCUyMDAlM0ElMEEyMDE1LTA1LTE3JTIwMTIlM0E0OSUzQTE4LjYxNzI3NiUyQyUyME1zZyUyMGlkJTIwNTAzJTIwdmFsdWUlMjAxNzIuNzk3ODk3JTIwb24lMjBjaGFubmVsJTIwMCUzQSUwQTIwMTUtMDUtMTclMjAxMiUzQTQ5JTNBMTguNjg2MjcxJTJDJTIwTXNnJTIwaWQlMjA1MDMlMjB2YWx1ZSUyMDE5LjY2MTc2NiUyMG9uJTIwY2hhbm5lbCUyMDAlM0ElMEEyMDE1LTA1LTE3JTIwMTIlM0E0OSUzQTE4Ljk3NDI3MSUyQyUyME1zZyUyMGlkJTIwNTAzJTIwdmFsdWUlMjAxODcuOTQzNzI2JTIwb24lMjBjaGFubmVsJTIwMCUzQSUwQTIwMTUtMDUtMTclMjAxMiUzQTQ5JTNBMTkuMzc0Mjc3JTJDJTIwTXNnJTIwaWQlMjA1MDMlMjB2YWx1ZSUyMDM5LjMxNjYyOCUyMG9uJTIwY2hhbm5lbCUyMDAlM0ElMEEyMDE1LTA1LTE3JTIwMTIlM0E0OSUzQTE5LjY1NzI3NyUyQyUyME1zZyUyMGlkJTIwNTAzJTIwdmFsdWUlMjA3OS42NTkzOTMlMjBvbiUyMGNoYW5uZWwlMjAwJTNB"][vc_column_text]
So, there we have it, all values of the EngineTemp between 12:49:10 and 12:49:20.

Footnotes:

1 The full program listings are available on http://github.com/Kvaser/developer-blog 2 The number of log files is not the same as the number of .kmf containers (log000000.kmf, log000001.kmf, etc) that can be seen on the SD card if we where to move the SD-card to a SD-card reader and look at the contents via our PC. A new log file is created every time a trigger starts logging. In our case, since we have used the configuration option "Log everything", a new log file will be created each time we apply CAN power (while having the USB disconnected). 3 Note that the naming of the functions in kvmlib have changed in the latest release to make them more uniform and hopefully easier to understand. The naming in the Python kvmlib wrapper have not yet fully been adapted. 4 What we actually read is the number of sectors this log file uses on the disk and knowing how many events we can have in a sector we convert and return this as a number of events. 5 In our case, we filter on message id 503 since that is where our signal EngineTemp is kept. The variable msgId is actually set in the main code and passed as a parameter. 6 I usually have both channels on the device connected to the same CAN bus in my test setup and filtering on the channel number will reduce the redundancy of logged CAN messages. 7 See http://en.wikipedia.org/wiki/Unix_time for more information about Unix time.
[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]
[/vc_column_text][/vc_column][/vc_row] [post_title] => Examining logged data with kvmlib and Python [post_excerpt] => [post_status] => publish [comment_status] => closed [ping_status] => closed [post_password] => [post_name] => examining-logged-data-with-kvmlib-and-python-2 [to_ping] => [pinged] => [post_modified] => 2022-10-04 13:32:55 [post_modified_gmt] => 2022-10-04 13:32:55 [post_content_filtered] => [post_parent] => 0 [guid] => https://www.kvaser.com/?post_type=developer_blog&p=39874 [menu_order] => 0 [post_type] => developer_blog [post_mime_type] => [comment_count] => 0 [filter] => raw ) [6] => WP_Post Object ( [ID] => 8035 [post_author] => 6 [post_date] => 2015-05-28 12:36:56 [post_date_gmt] => 2015-05-28 12:36:56 [post_content] => [vc_row][vc_column][vc_column_text]Kvaser is participating in several CAN FD Tech Days in the Europe in 2015. Come along to hear about the latest CAN FD developments, answer your CAN FD questions, exchange views and network with CAN FD experts. The events are as follows:[/vc_column_text][vc_column_text]CAN FD Tech Day Stuttgart  – 30th June 2015 Kent Lennartson delivered a presentation on how to integrate CAN FD into a classical CAN architecture.  Download the presentation PDF here.[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]CAN FD Tech Day Prague – 24th September 2015 Venue: Hotel Alwyn, Vitkova 26/151, 18600 Prague 8 - Karlin Of special interest: CANopen FD. Presentations on this next generation data link layer and its impacts on system design and higher-layer protocols are part of this event.   CAN FD Tech Day Göteborg – 10th December 2015 Venue: TBD Of special interest: Presentations on this next generation data link layer and its impacts on system design and higher-layer protocols are part of this event.  It serves as a platform for technical discussions and networking. At the accompanying tabletop exhibition, CAN-related products and services are displayed.   [/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_separator_raket][vc_column_text]At each of the above events, Kvaser’s hardware manager, Kent Lennartsson, will present a paper entitled ‘CAN-FD FILTER FOR CLASSICAL CAN DEVICES AND PHYSICAL LAYER DIAGNOSTICS’.  Use the form above to download it in advance. You’ll also be able to see Kvaser’s CAN FD demonstrator in the tabletop exhibit. For more information and to register for any of the above events, please visit www.can-cia.org. For more information on CAN FD in general, click here.[/vc_column_text][/vc_column][/vc_row] [post_title] => Kvaser Presenting at CiA's CAN FD Tech Days Europe [post_excerpt] => Come along to hear about the latest CAN FD developments, answer your CAN FD questions, exchange views and network with CAN FD experts. Download the CAN FD presentation. [post_status] => publish [comment_status] => closed [ping_status] => closed [post_password] => [post_name] => kvaser-presenting-at-cias-can-fd-tech-days-europe [to_ping] => [pinged] => [post_modified] => 2022-09-29 04:14:13 [post_modified_gmt] => 2022-09-29 04:14:13 [post_content_filtered] => [post_parent] => 0 [guid] => https://www.kvaser.com/?p=8035 [menu_order] => 0 [post_type] => post [post_mime_type] => [comment_count] => 0 [filter] => raw ) [7] => WP_Post Object ( [ID] => 7640 [post_author] => 5 [post_date] => 2015-05-26 06:52:11 [post_date_gmt] => 2015-05-26 06:52:11 [post_content] => Until recently, petrol was the standard choice for most pleasure boat powerplants. More compact, lighter and more powerful than their traditional diesel counterparts, petrol engines were the ideal choice for small pleasure and light commercial applications where limited operating hour requirements and tighter cost constraints have traditionally driven powertrain selection.
“In most commercial situations, however, diesel technology is recognised as superior – more fuel efficient and robust, but heavy, complex and expensive,” explains Christer Flodman, technical manager for Cimco Marine Diesel AB. “But a new generation of stronger, lighter and even more fuel efficient diesel engines has tipped the balance and is making diesel an option for the outboard engine in smaller marine applications.”
Cimco Marine Diesel has recently launched the world’s first high performance, high efficiency marine outboard diesel engine, called the OXE. The innovative gearbox belt design – originally developed for stern drives and inboard engine technology - eliminates the need for conventional complex bevel gears and transfer shafts to efficiently transfer the drive of a common-rail diesel engine. For this project Cimco has marinized a standard GM 2.0-litre turbo diesel engine by designing separate systems for seawater, heat exchangers, intercooler and oil cooler as well as mounting the entire powerplant horizontally. All service points are at the front of the engine, so maintenance and servicing can be performed on the water, whilst the addition of a dry sump system maintains consistent oil lubrication in all running conditions, allowing for rolling in heavy seas, plus tilting and trimming situations. Whilst diesel outboard engines for light marine applications aren’t new, they aren’t commonplace either and they have historically been large and low power – the most popular being just 37bhp. The OXE is the world’s first 200bhp production diesel outboard motor, and a number of engine sizes are in development – both smaller and larger than 200bhp. Throughout the project Cimco Marine AB has relied on a tool chain supplied by Kvaser technical associate, Accurate Technologies (ATI) Sweden AB. ATI supplied products used by CIMCO on the OXE program include ATI VISION ECU calibration and data acquisition software, CSM data acquisition hardware, and Kvaser USBcan Pro and Memorator Pro interfaces and data loggers for CAN analysis. The modular suite of hardware and software was used throughout the evaluation program. Marine engines undergo similar test procedures as those in the automotive industry. Dyno tests simulate different climatic conditions, plus cold start, emissions and numerous sea trials. Kvaser CAN interfaces were used in static test rigs such as those to optimise drivetrain losses and hydraulic pressure testing, as well as on all sea trials in test cells.
Notes Flodman: “All the products worked excellently together. Minimal feedback and support were required from ATI as the software, DAQ modules and Kvaser’s CAN interfaces and dataloggers were all extremely easy to set up. I had used these products before but the rest of the team hadn’t. They were impressed. They provided us with a strong and efficient toolchain that let us focus on the product development, rather than spending valuable time solving test equipment issues.”
Cimco Marine Diesel AB was set up in 2012 to bring the OXE to commercial reality. However, development of the OXE technology has taken over six years, with component test – belt system, engine, gearbox, electrical system, fuel system and air intake etc. – over a period of three years to allow for rigorous sea trials. “What took the time,” recounts Flodman, “was packaging the system into a small, light form factor that would meeting the running conditions of commercial craft, which are much tougher than the pleasure market.” Potential applications vary enormously and include coastguard patrol where intermediate loads are required for many hours; transportation between fish farms, where long distances are involved and the engine may idle for long periods; and military applications where a maximum load is required in harsh environmental conditions, because the user’s life depends upon the product. Whilst the OXE has not been designed to meet military specifications, the armed forces’ single fuel policy objective means that many military applications would benefit greatly from a small diesel engine alternative. [post_title] => Kvaser data loggers used to develop first ever 200bhp diesel outboard motor [post_excerpt] => Cimco Marine Diesel has recently launched the world’s first high performance, high efficiency marine outboard diesel engine - the OXE. Find out more about how it was developed, using a tool chain supplied by Kvaser technical associate, Accurate Technologies Sweden AB. [post_status] => publish [comment_status] => closed [ping_status] => closed [post_password] => [post_name] => kvaser-dataloggers-used-to-develop-first-ever-200bhp-diesel-outboard-motor [to_ping] => [pinged] => [post_modified] => 2022-09-29 04:14:13 [post_modified_gmt] => 2022-09-29 04:14:13 [post_content_filtered] => [post_parent] => 0 [guid] => https://www.kvaser.com/?p=7640 [menu_order] => 0 [post_type] => post [post_mime_type] => [comment_count] => 0 [filter] => raw ) [8] => WP_Post Object ( [ID] => 5661 [post_author] => 5 [post_date] => 2015-05-09 17:53:49 [post_date_gmt] => 2015-05-09 17:53:49 [post_content] => [vc_row][vc_column][vc_single_image image="5662" img_size="full"][vc_column_text]New to Kvaser’s interface portfolio is the Kvaser USBcan Light 2xHS, a USB to dual channel Controller Area Network (CAN) interface. With a USB 2.0 compliant connector at one end and two 9-pin D-SUB connectors at the other, USBcan Light 2xHS is a compact, reliable and cost-effective means of connecting two high speed CAN busses to a PC or mobile computer in applications as wide ranging as automotive, mining, marine, military, oil and gas exploration, military, industrial and heavy machinery. A fraction larger than the one-channel Leaf Light v2, the Kvaser USBcan Light 2xHS features the sleek, ergonomically designed housing that Kvaser products are renowned for and comes with galvanic isolation as standard. Kvaser USBcan Light 2xHS is supplied with CANlib, the software API that is common to all Kvaser hardware. Taking just 30 seconds to programme once you have Canlib downloaded on the host computer, USBcan Light 2xHS is simple to install and configure. For more information on the Kvaser USBcan Light 2xHS interface, please click through to: www.kvaser.com/product/USBcanLight2xHS[/vc_column_text][/vc_column][/vc_row] [post_title] => Double your CAN capabilities with the USBcan Light 2xHS [post_excerpt] => the Kvaser USBcan Light 2xHS, a USB to dual channel Controller Area Network (CAN) interface. With a USB 2.0 compliant connector at one end and two 9-pin D-SUB connectors at the other, USBcan Light 2xHS is a compact, reliable and cost-effective means of connecting two high speed CAN busses to a PC or mobile computer. [post_status] => publish [comment_status] => open [ping_status] => open [post_password] => [post_name] => dual-can-to-usb-interface [to_ping] => [pinged] => [post_modified] => 2022-09-29 04:14:13 [post_modified_gmt] => 2022-09-29 04:14:13 [post_content_filtered] => [post_parent] => 0 [guid] => https://www.kvaser.com/?p=5661 [menu_order] => 0 [post_type] => post [post_mime_type] => [comment_count] => 0 [filter] => raw ) [9] => WP_Post Object ( [ID] => 39875 [post_author] => 14 [post_date] => 2015-05-06 13:33:20 [post_date_gmt] => 2015-05-06 13:33:20 [post_content] => [vc_row][vc_column][vc_column_text]When interacting with CANlib, many functions need a handle to a channel. This channel is often referred to as the "CANlib Channel" because this is how it is labeled in Kvaser Hardware.[/vc_column_text][vc_single_image image="7404" img_size="large"][vc_column_text]If we want to send CAN messages from the first channel on the Eagle device, we should open CANlib channel three canopenChannel(3, canOPEN_EXCLUSIVE). Some functions in CANlib are independent of the actual channel on the device and therefore you could use any device channel with equal success. For example, to turn the device LEDs on or off you call kvFlashLeds(hnd, kvLED_ACTION_ALL_LEDS_ON) where hnd could be a handle for CANlib channel three or four. So why the need for a Card Number? Well, historically, all interaction with Kvaser devices that did not go through the Kvaser CANlib was directed to the driver directly. In this case the CANlib channel number could not be used an thus a new number was needed to indicate e.g. "the second device" using the driver kcany. This new number was called the "Card Number" and is shown in Kvaser Hardware when a device channel is selected.[/vc_column_text][vc_single_image image="7405" img_size="large"][vc_column_text]In the figure above, we can see that the Kvaser Memorator Pro 5xHS, which is a five channel device, is connected to CANlib channel six and Card Number two. Both the CANlib channel and Card Number is starting from zero (as programmers usually do), but through some random act of fate, the Card Number is presented in Kvaser Hardware (and in Kvaser Hardware only) as if it was started from one. So our device is actually connected to CANlib channel six but Card Number one which means that we need to issue the command hydra_flash.exe -C1 imagefile.img in order to upgrade the firmware of this device. Nowadays, this is little more than a historical anecdote since we get the zero indexed Card Number by calling CANlib (canGetChannelData(channel, canCHANNELDATA_CARD_NUMBER, buffer, bufsize)). This is also how the Python module kvDevice does it in order to assist you when interfacing other libraries (such as kvmlib) that uses the Card Number. Still, it is fun to know how stuff works...[/vc_column_text][vc_column_text]

Comments?  Contact us directly at [email protected].

[/vc_column_text][/vc_column][/vc_row] [post_title] => Was that the CANlib channel number or Card Number? [post_excerpt] => [post_status] => publish [comment_status] => closed [ping_status] => closed [post_password] => [post_name] => canlib-channel-number-card-number [to_ping] => [pinged] => [post_modified] => 2022-10-04 13:35:18 [post_modified_gmt] => 2022-10-04 13:35:18 [post_content_filtered] => [post_parent] => 0 [guid] => https://www.kvaser.com/?post_type=developer_blog&p=39875 [menu_order] => 0 [post_type] => developer_blog [post_mime_type] => [comment_count] => 0 [filter] => raw ) ) [post_count] => 10 [current_post] => -1 [in_the_loop] => [post] => WP_Post Object ( [ID] => 39871 [post_author] => 14 [post_date] => 2015-09-01 13:24:13 [post_date_gmt] => 2015-09-01 13:24:13 [post_content] => [vc_row][vc_column][vc_column_text]This is the first post in a 3-part series about Environment Variables in t programs:
  1. Introduction to Environment Variables
  2. Accessing Environment Variables from CANlib
  3. Kvaser TRX and Environment Variables
[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]This first post introduces the environment variables and shows how they can be used in a t program. 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.[/vc_column_text][vc_single_image image="8108" img_size="full"][vc_column_text]Figure 1: An overview of how the information about the environment variable's value is distributed.[/vc_column_text][vc_column_text]The term "envvar" is often used as a shorthand writing for the longer environment variable. For full documentation, read the Kvaser t Programming Language documentation 1. An environment variable can only be defined in an envvar section in a t program. Just like a variable defined in a variables section, an environment variable is visible globally. This is equivalent to defining something in global scope in a C program, i.e. the variable is visible between the declaration and the end of the compilation. The type of an environment variable can be either int, float or an array of char.[/vc_column_text][vc_code_raket header="Definition of environment variables" code="ZW52dmFyJTIwJTdCJTBBJTIwJTIwY2hhciUyME1lc3NhZ2UlNUIxMjglNUQlM0IlMEElMjAlMjBpbnQlMjBTZXZlcml0eSUzQiUwQSUyMCUyMGludCUyMEhvc3RJZFJlcXVlc3QlM0IlMEElMjAlMjBpbnQlMjBIb3N0SWRDb25uZWN0ZWQlM0IlMEElN0Q="][vc_column_text]The size of an environment variable is limited to ENVVAR_MAX_SIZE (4096 in version 3.2 of the t compiler) and you can define up to a maximum of 32 environment variables. Unlike ordinary variables, environment variables cannot be initialized or accessed directly in the t program. Instead, they are accessed using envvarSetValue() and envvarGetValue().[/vc_column_text][vc_code_raket header="Setting an environment variable" code="dm9pZCUyMHNldEhvc3RJZENvbm5lY3RlZCUyMCUyOGludCUyMHZhbHVlJTI5JTBBJTdCJTBBJTIwJTIwaG9zdElkQ29ubmVjdGVkJTIwJTNEJTIwdmFsdWUlM0IlMEElMjAlMjBlbnZ2YXJTZXRWYWx1ZSUyOEhvc3RJZENvbm5lY3RlZCUyQyUyMHZhbHVlJTI5JTNCJTBBJTdE"][vc_column_text]The function envvarSetValue() will set the value of the environment variable. The actual update will be queued and therefore delayed until the execution of the current hook has finished. A notification that the environment variable has been updated is then propagated to all programs that have declared the same environment variable and have a corresponding on envvar hook. In this context, updated includes the setting of the same value as before. Since the actual update of the environment variable is delayed, it is possible to initiate a new update of the same environment variable during this delay. In this case, the older value is lost. So every time you read an environment variable you get its latest value and if you want to make sure that every change is seen, you need to implement a hand shaking scheme using at least two environment variables.[/vc_column_text][vc_code_raket header="The on envvar hook" code="JTJGJTJGJTIwUHJpbnQlMjBpbmNvbWluZyUyMG1lc3NhZ2VzJTBBb24lMjBlbnZ2YXIlMjBNZXNzYWdlJTIwJTdCJTBBJTIwJTIwY2hhciUyMG1zZyU1QjEyOCU1RCUzQiUwQSUyMCUyMGludCUyMHNldmVyaXR5JTNCJTBBJTIwJTIwZW52dmFyR2V0VmFsdWUlMjhNZXNzYWdlJTJDJTIwbXNnJTI5JTNCJTBBJTIwJTIwZW52dmFyR2V0VmFsdWUlMjhTZXZlcml0eSUyQyUyMCUyNnNldmVyaXR5JTI5JTNCJTBBJTIwJTIwcHJpbnRmJTI4JTIyU2V2ZXJpdHklM0ElMjAlMjVkJTIwLSUyMCUyNXMlNUNuJTIyJTJDJTIwc2V2ZXJpdHklMkMlMjBtc2clMjklM0IlMEElN0Q="][vc_column_text]The function envvarGetValue() retrieves the last known value of the environment variable. The result is undefined if the environment variable is not initialized. Full program listings are available on http://github.com/Kvaser/developer-blog. The next post in this series will show how to access the environment variable in CANlib.[/vc_column_text][vc_column_text]

Footnotes:

1 The Kvaser t Programming Language documentation is available from https://www.kvaser.com/download/#?filter=t%20programming.[/vc_column_text][/vc_column][/vc_row] [post_title] => Introduction to Environment Variables (1 of 3) [post_excerpt] => [post_status] => publish [comment_status] => closed [ping_status] => closed [post_password] => [post_name] => introduction-to-environment-variables-1-of-3 [to_ping] => [pinged] => [post_modified] => 2022-10-04 13:25:17 [post_modified_gmt] => 2022-10-04 13:25:17 [post_content_filtered] => [post_parent] => 0 [guid] => https://www.kvaser.com/?post_type=developer_blog&p=39871 [menu_order] => 0 [post_type] => developer_blog [post_mime_type] => [comment_count] => 0 [filter] => raw ) [comment_count] => 0 [current_comment] => -1 [found_posts] => 469 [max_num_pages] => 47 [max_num_comment_pages] => 0 [is_single] => [is_preview] => [is_page] => [is_archive] => [is_date] => [is_year] => [is_month] => [is_day] => [is_time] => [is_author] => [is_category] => [is_tag] => [is_tax] => [is_search] => [is_feed] => [is_comment_feed] => [is_trackback] => [is_home] => 1 [is_privacy_policy] => [is_404] => [is_embed] => [is_paged] => 1 [is_admin] => [is_attachment] => [is_singular] => [is_robots] => [is_favicon] => [is_posts_page] => 1 [is_post_type_archive] => [query_vars_hash:WP_Query:private] => b3f74f0117814233b7c49aa016d64453 [query_vars_changed:WP_Query:private] => 1 [thumbnails_cached] => [stopwords:WP_Query:private] => [compat_fields:WP_Query:private] => Array ( [0] => query_vars_hash [1] => query_vars_changed ) [compat_methods:WP_Query:private] => Array ( [0] => init_query_flags [1] => parse_tax_query ) )

News and Events

Introduction to Environment Variables (1 of 3)

01/09/2015

This is the first post in a 3-part series about Environment Variables in t programs: Introduction to Environment Variables Accessing… Read More

Read More
Kvaser to participate in CAN FD Tech Day in Shanghai, China

Kvaser to participate in CAN FD Tech Day in Shanghai, China

19/08/2015

Kvaser is participating in CAN FD Tech Day China, which takes place on 9th September 2014 in Shanghai. Organised by… Read More

Read More

Setting Up CANlib for Visual Studio

08/07/2015

This is the first post in a 3-part series about CANlib development: Setting up CANlib in Visual Studio Basic API Calls… Read More

Read More

Kvaser launches four channel PCI Express to CAN card that is our fastest yet

04/06/2015

Kvaser AB has introduced the Kvaser PCIEcan 4xHS, a highly integrated, high speed controller area network (CAN) network card that… Read More

Read More

The CAN handle vs channel number

03/06/2015

When writing “Was that the CANlib channel number or Card Number?“, I got a comment asking for clarification about the… Read More

Read More

Examining logged data with kvmlib and Python

29/05/2015

This blog uses now deprecated functions, see blog “Improved API in Python canlib v1.5” for more information. Today we take a look… Read More

Read More

Kvaser Presenting at CiA’s CAN FD Tech Days Europe

28/05/2015

Kvaser is participating in several CAN FD Tech Days in the Europe in 2015. Come along to hear about the latest CAN… Read More

Read More
Kvaser data loggers used to develop first ever 200bhp diesel outboard motor

Kvaser data loggers used to develop first ever 200bhp diesel outboard motor

26/05/2015

Until recently, petrol was the standard choice for most pleasure boat powerplants. More compact, lighter and more powerful than their… Read More

Read More
Double your CAN capabilities with the USBcan Light 2xHS

Double your CAN capabilities with the USBcan Light 2xHS

09/05/2015

New to Kvaser’s interface portfolio is the Kvaser USBcan Light 2xHS, a USB to dual channel Controller Area Network (CAN)… Read More

Read More

Was that the CANlib channel number or Card Number?

06/05/2015

When interacting with CANlib, many functions need a handle to a channel. This channel is often referred to as the… Read More

Read More