5 — VEHICLE CONTROL LANGUAGE (VCL)
pg. 109
Return to TOC Curtis Model 1351 – December 2018
Example Receive SRDO Setup
e example below assumes the variables have been setup previously for the mailbox handles, Node
IDs and message data. Aer this set up, the main loop of VCL must check for the valid operation of
the SRDO reception using the VCL function check_SRDO_receive(SRDO_RCV_Handle). If
it returns a non-zero value, there is a SRDO fault and the data received nay not be valid.
Note that only the rst message Primary port Receive mailbox Data is dened. In an SRDO Receive,
the Supervisor and Primary will use the same data denition for both messages, but will check for the
inverted the data and timing automatically
; ==================== SETUP SRDO Receive =============
; Assign four mailboxes, two for primary and two for supervisor:
SRDO_Primary_First_Mailbox = assign_can_mailbox(0, C_RCV)
SRDO_Primary_Second_Mailbox = assign_can_mailbox(0, C_RCV)
SRDO_Supervisor_First_Mailbox = assign_can_mailbox(1, C_RCV)
SRDO_Supervisor_Second_mailbox = assign_can_mailbox(1, C_RCV)
; Congure these four mailboxes as SRDO type
setup_canopen_receive_mailbox(SRDO_Primary_First_Mailbox, SRDO, SRDO_RCV_ODD_ID, 0x7FF, 0)
setup_canopen_receive_mailbox(SRDO_Primary_Second_Mailbox, SRDO, SRDO_RCV_EVEN_ID, 0x7FF, 0)
setup_canopen_receive_mailbox(SRDO_Supervisor_First_Mailbox, SRDO, SRDO_RCV_ODD_ID, 0x7FF, 0)
setup_canopen_receive_mailbox(SRDO_Supervisor_Second_mailbox, SRDO, SRDO_RCV_EVEN_ID, 0x7FF, 0)
; Dene the received data for the mailboxes
; e dual message SRDO data is compared in the rmware,
; Only valid data will be received into variables dened below:
dene_canopen_receive_data(SRDO_Primary_First_Mailbox, CAN_1_RPDO1_byte_1, 0, 8)
dene_canopen_receive_data(SRDO_Primary_First_Mailbox, CAN_1_RPDO1_byte_2, 0, 8)
dene_canopen_receive_data(SRDO_Primary_First_Mailbox, CAN_1_RPDO1_byte_3, 0, 8)
dene_canopen_receive_data(SRDO_Primary_First_Mailbox, CAN_1_RPDO1_byte_4, 0, 8)
; Setup this SRDO: 800 ms between message packages, 300ms between rst and second (inverted data) messages
SRDO_RCV_Handle = setup_receive_SRDO(SRDO_Primary_First_Mailbox,
SRDO_Primary_Second_Mailbox, SRDO_Supervisor_First_Mailbox,
SRDO_Supervisor_Second_mailbox, 800, 300)
; Enable SRDO
Enable_Receive_SRDO(SRDO_RCV_Handle)