CANopen:CAN HB MSG GET

From SoftMC-Wiki
Jump to: navigation, search


Return contents of most recent Heart Beat message to from the slave.
System stores contents of most resent Heart Beat message from every slave (per slave), with each message reference counter is incremented.
Reference counter shall be used for detection a new data.

Input

Dadd - drive address
Offset - offset in PDO from where data will be copied
Size - how many bytes to copy 1..4

Output

lRefCnt - reference counter - incremented when Hear Beat message is recieved

Return Value

Emergency message data copied from offset and size

Declaration

public function CAN_HB_MSG_Get(byval lDadd as long , byval lOffset as long,byval lSize as long, lRefCnt as long) as long

Syntax

PdoData = CAN_HB_MSG_Get(<Dadd>,<Offset>,<size>,RefCnt)

Limitations

Signed 8 and 16 bit objects are not properly converted to LONG. For example 8-bit negative value, eg. -3, read as 253. Application shall apply sign extension for negative 8/16 bit objects.

Exceptions

Examples

program

dim cnt as long
dim data0 as long
dim data1 as long
dim addr as long  = 1
data0 = CAN_HB_msg_get(addr,1,2,cnt)
data1 = CAN_HB_msg_get(addr,3,4,cnt)
print "Heat-Beat"
print "Drive ";addr;" Data0 ";data0 hex; " data 1 ";data1 hex;" ref counter ";cnt
end program ' <MyTask>.prg

See Also