Difference between revisions of "CANopen:CAN PDO READ"

From SoftMC-Wiki
Jump to: navigation, search
(Created page with "{{Template:CANopen Functions |DESCRIPTION= <br/> Return contents of recent PDO message to from the slave.<br/> System stores most resent PDO message from every slave, with ea...")
 
 
Line 5: Line 5:
 
Return contents of recent PDO message to from the slave.<br/>
 
Return contents of recent PDO message to from the slave.<br/>
 
System stores most resent PDO message from every slave, with each PDO reference counter is incremented.<br/>
 
System stores most resent PDO message from every slave, with each PDO reference counter is incremented.<br/>
Reference counter shall be used in order to detect a new data.<br/>
+
Reference counter shall be used for detection a new data.<br/>
  
 
|INPUT=
 
|INPUT=

Latest revision as of 16:01, 8 February 2015


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

Input

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

Output

lRefCnt - reference counter - increments each PDOx is recieved

Return Value

PDO data copied from offset and size

Declaration

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

Syntax

PdoData = CAN_PDO_Read(<Dadd>,<pdoNum>,<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 lRefCnt as long=0
dim lPdoVal as long=0

lPdoVal = CAN_PDO_Read(1 , 1,0,2, lRefCnt)
print "LValue ",lPdoVal hex,"ref count=",lRefCnt
lPdoVal = CAN_PDO_Read(1 , 4,0,2, lRefCnt)
print "LValue ",lPdoVal hex,"ref count=",lRefCnt
lPdoVal = CAN_PDO_Read(1 , 1,0,2, lRefCnt)
print "LValue ",lPdoVal hex,"ref count=",lRefCnt

end program ' <MyTask>.prg

See Also