Windows Advanced Topics

Table of Contents

Named Parameter Sets

CANlib allows you to store a number of named parameter sets in the Registry. Each parameter set has a name and contains CAN bus parameters such as bit rate, SJW, etc.

The idea is that an application or setup program can define a number of parameter sets suitable for different hardware configurations such as, for example, a low-speed bus, certain test configurations, and so on. Another application can retrieve the list of named parameter sets from the Registry, display them in a list and can so let the user choose a set of bus parameters using a understandable name instead of a bunch of cryptic numbers.

So you can, for example, create a set of parameters for accessing a low-speed bus:

canParamSetName(i, "Low-speed bus");
canParamSetBusParams(i, 83333, 4, 3, 2, 1, 0);
canParamSetChannelNumber(i, 0); // Assuming the low-speed bus in
// question is connected to channel 0

Then, in the program, you can use canParamGetCount() and canParamGetName() to fill a combobox with the names of the defined parameter settings, and let the user choose one of them. Then you can use the index of that setting and pass it to canParamGetBusParams() to get the bus parameters, which you then pass on to canSetBusParams().

See also
canParamGetCount()
canParamCommitChanges()
canParamDeleteEntry()
canParamCreateNewEntry()
canParamSwapEntries()
canParamGetName()
canParamGetChannelNumber()
canParamGetBusParams()
canParamSetName()
canParamSetChannelNumber()
canParamSetBusParams()
canParamFindByName()