CANopen:can pdo write

From SoftMC-Wiki
Jump to: navigation, search


Write (send) PDO message to a slave.
This function allows sending of PDO to the slave. System will immidiately send PDO message via CAN controller

Input

Slave address
pdo

Output

None

Return Value

None

Declaration

public sub can_pdo1_write(byval addr as long, byval pdo as pdo_type)
public sub can_pdo2_write(byval addr as long, byval pdo as pdo_type)
public sub can_pdo3_write(byval addr as long, byval pdo as pdo_type)
public sub can_pdo4_write(byval addr as long, byval pdo as pdo_type)

Syntax

call can_pdo1_write(<Slave address>, <pdo>)

Exceptions

Examples

dim shared pdo1 as pdo_type
program
dim lRefCnt as long=0
dim lPdoVal as long=0

pdo1->data[1]=0x1234
pdo1->length[1]=2
pdo1->data[2]=0x5678abcd
pdo1->length[2]=4
pdo1->data[3]=0xca
pdo1->length[3]=1
pdo1->data[4]=0xfa
pdo1->length[4]=1
pdo1->length[5]=0
pdo1->length[6]=0
pdo1->length[6]=0
pdo1->length[7]=0

call can_pdo1_write(1, pdo1)


pdo1->data[1]=0x12345678
pdo1->length[1]=4
pdo1->data[2]=0xabcd
pdo1->length[2]=2
pdo1->data[3]=0xcafe
pdo1->length[3]=2
pdo1->length[4]=0
pdo1->length[5]=0
pdo1->length[6]=0
pdo1->length[6]=0
pdo1->length[7]=0

call can_pdo4_write(5, pdo1)


pdo1->data[1]=0x12345678
pdo1->length[1]=4
pdo1->data[2]=0xabcdef11
pdo1->length[2]=0
pdo1->length[3]=0
pdo1->length[4]=0
pdo1->length[5]=0
pdo1->length[6]=0
pdo1->length[6]=0
pdo1->length[7]=0

call can_pdo4_write(5, pdo1)
end program

See Also