Comfort functions (The Standard-UDS Library)

As shown in the extended functions, SKDS has some built-in functions to enable the basic communication to the modules.

But to make it more comfortable, the OEM data 1) of SKDS includes a library, which supports several helpful functions.

This library is made as a collection of Hyperterp functions. To use these functions in your own scripts, just include the standard-UDS.pas in the beginning of your own scripts by using the skdsc-directive

(*#include <standard-UDS.pas>*)

and use the skdsc -I command line parameter to define where the include-file can be found:

skdsc -I \path_to_includes\standard-UDS.pas file_to_compile.pas

User Functions

By including the library, the included „end-user“ functions automatically appear in the function table.

How to transfer module specs into SKDS

Although the standard library already contains a lot of functions to handle the common data of modules, there are tons of module specific values left, which need to be implemented per each module.

To assist this work, the standard library contains some functions which act as a kind of generic interface between a Module specification and SKDS:

procedure getNUMPID( hpid: byte ; lpid: Byte ; dlen: Byte ; resolution : real ; offset : real ; valunit : string )
procedure getPIDBMP( hpid : byte ; lpid : Byte ; bytenr : integer ; bytepos : Byte ; negstring : String ; posstring : string)		
procedure getPIDASC( hpid : byte ; lpid : Byte ; nrofchar : Byte )
procedure setPIDBMP( hpid : byte ; lpid : Byte ; bytenr : integer ; bytepos : Byte ; negstring : String ; posstring : string)		

You might notice that the parameters of these functions are equivalent to the type of values given in the module spec. The trick now is to use some Excel formulas to reformat the module spec into Hyperterp function calls.

This can be archived in the following way:

After compiling the script and loading it into SKDS, do a quick run (with the „Update“- Button) through all generated functions. It might quite often happen, that an overseen special character, a blank cell or a wrong number format causes a Hyperterp runtime syntax error. Correct the error in the Excel file and run through the steps above again.

A common problem with the spec files are that not each single row is filled with the complete parameter set. The following autoFill- macro fills the gaps. Assuming you've a table content like this

PID Byte Bit
0815 1 0
1
2
3
2 1
2
3
4
4711 1 0
1
2
3
2 1
2
3
4

just select that area and let the macro run. The result will be

PID Byte Bit
0815 1 0
0815 1 1
0815 1 2
0815 1 3
0815 2 1
0815 2 2
0815 2 3
0815 2 4
4711 1 0
4711 1 1
4711 1 2
4711 1 3
4711 2 1
4711 2 2
4711 2 3
4711 2 4

The macro itself:

Sub autofill_Part2_Parameter_fiels()
'
' autofill_Part2_Parameter_fiels Macro
' This macro autofills the gaps in a part2 spec
'
 
Dim Arr() As Variant
Dim area As Range
Dim C As Range
Dim sizeX As Long
Dim sizeY As Long
Dim countY As Long
 
On Error GoTo EndMacro
 
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
 
    Set area = Selection
    sizeX = area.Columns.Count
    sizeY = area.Rows.Count
    If sizeX > 1 And sizeY > 1 Then
        sizeX = sizeX - 1
        While sizeX > 0
            For countY = 2 To sizeY
                If area.Cells(countY, sizeX).Value = "" And area.Cells(countY, sizeX + 1).Value <> "" Then
                    area.Cells(countY, sizeX).Value = area.Cells(countY - 1, sizeX).Value
                End If
                 'area.Cells(countY, sizeX) = "x"
            Next
            sizeX = sizeX - 1
        Wend
    End If
EndMacro:
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
 
End Sub
1)
not included in the base software pack, only awailable for OEMs