ADwin-Gold II
, Manual February 2013
159
CAN interface
Transmit
ADwin
Transmit
TRANSMIT
sends the message in
CAN_Msg
via the specified message object.
Syntax
#Include
ADwinGoldII.inc / GoldIITiCo.inc
Transmit
(
can_no
,
msg_no
)
Parameters
Notes
To send a message you have to follow the correct order:
•
Once: Enable the message object with
En_Transmit
for sending.
•
As often as needed: Enter the message into the array
CAN_Msg
:
Data bytes and number of data bytes.
•
Send the message with
Transmit
.
CAN interface will send the message as soon as the message object
has received access rights to the CAN bus.
See also
,
Valid for
Gold II-CAN
Example
Rem Please select the appropriate include for ADbasic /
TiCoBasic
#
I
nclude
ADwinGoldII.inc / GoldIITiCo.inc
REM Send a 32 Bit FLOAT
-
value (here: P
i
)
as sequence of
REM 4 bytes
i
n a message object
REM (Receiving of a float value see example at
)
#Define
pi
3
.
14159265
Dim
i
As
Long
Init:
Init_CAN
(
2
)
'Initialize CAN controller
REM Enable message object 6
REM for sending with the identifier 40 (11 bit)
En_Transmit
(
2
,
6
,
40
,
0
)
REM Create bit pattern of Pi with data type Long
Par_1
=
Cast_FloatToLong
(
pi
)
REM divide bit pattern (32 Bit) into 4 bytes
CAN_Msg
[
4
]
=
Par_1
And
0FFh
'assign LSB
For
i
=
1
To
3
CAN_Msg
[
4
-
i
]
=
Shift_Right
(
Par_1
,
8
*
i
)
And
0FFh
Next
i
CAN_Msg
[
9
]
=
4
'message length in bytes
Event:
Transmit
(
2
,
6
)
'Send message object 6
Receiving a float value see example at
T11 TiCo
can_no
Number (1, 2) of CAN interface.
LONG
msg_no
Number (1…14) of the message object.
LONG