Please enable JavaScript to view this site.

Kickdrive User Manual

The CAN Sender module can be used for simple CAN testing applications which require sending one or several fixed CAN frames.

It is not a full scripting engine (for that, use the Automation module) but a simple macro sequence for quick and easy testing.

 

Available commands

send <ID>,<dataSize>,<dataHex>

delay <milliseconds>

wait <ID>,<dataSize>,<dataHex>[,<timeoutMillisec>]

 

ID and dataSize format

ID and data size can be provided as hex expressions:

send 0x7e5,2,04 01 

or

send 7e5h,0x2,04 01

 

dataHex format

CAN frame data format as used in the CAN Monitor module. Data bytes must be a two-digit number always, so for a zero byte use "00" and not "0".

Valid example: send 601h,8,40 41 60 00 00 00 00 00

(Invalid  example, don't use: send 601h,8,40 41 60 0 0 0 0 0 )

 

Wait conditions

wait supports string wildcards * and ? for the <data hex> parts. An additional timeout can be specified.

Example:

wait 581h,8,4b 41 60 00 ?? ?4 *,1000

(waits for a status word where the highest four bits are "4". gives up after one second)

 

Extended 29 bit CAN ID support

Use the "ext" specifier before the ID value. Example:

send ext 432635,8,06 01 00 00 00 00 00 00  

or with the CAN ID in HEX format:

send ext 699FBh,8,06 01 00 00 00 00 00 00  

 

Remote Frames support

Use the "R" specifier before the ID. Example:

send R 701h,1,00 

 

Macro support

The following macros can be used inside the send and wait commands:

 

canid(<expression>)

calculates the expression and returns a standard CAN ID / COB ID in hex format as expected for the <ID> parameter.

 

canunsigned32(<expression>) or caninteger32(<expression>) 

calculates the expression and returns a 4-byte CAN data block that can be used as part of the <dataHex> parameter. E.g.

send 67eh,8,23 7a 60 00 caninteger32(12345)

 

canunsigned16(<expression>) or  caninteger16(<expression>) 

as before, but 2 byte result

 

canunsigned8(<expression>) or caninteger8(<expression>) 

as before, but 1 byte result

 

Macro Example:

nodeId = 1

velocity = 1000

send canid(0x600 + nodeId),8,23 ff 60 00 canunsigned32(velocity)

 

Endless and conditional loops

Simple endless loop:

do

...

loop  

 

Loop until a wait command has found the message:

do

  ...

  wait ...

loop until found

 

Example:

do

   do 

      ; request status 

      send canid(0x600 + nodeId),8,40 41 60 00 00 00 00 00

      ; wait for target reached (status word upper four bits = 4)

      ; using 0.5 seconds timeout

      wait canid(0x580 + nodeId),8,4b 41 60 00 ?? ?4 ?? ??,500

   loop until found

 

   ; target has been reached. wait until drive moves again

 

   do 

      send canid(0x600 + nodeId),8,40 41 60 00 00 00 00 00

      wait canid(0x580 + nodeId),8,4b 41 60 00 ?? ?0 ?? ??,500

   loop until found

loop

 

 

 

 

Industrial software and services from Kickdrive Software Solutions / Impressum