4.2 JNMMCANTx

This function transmits a message on the selected CAN port.

int JNMMCANTx(int can_fd, CANMESSAGE* msg);

Name

Description

can_fd

can_fd is received from JNMMCANOpen().

Pointer to CANMESSAGE structure

Can_ch : CAN port numer 0-3

Msg_type : 0 : Standard

1 : Extended

Msg_ID : Hexadecimel value

Msg_len : length of the frames

Rtr : 0 : Disable

1 : Enable

Data : Holds the data frame of message length

Return Value

Error code or 0.

Usage Example

For transmitting the message.

Tx.Can_ch = 0;
Tx.Msg_type = MSG_STANDARD;
Tx.Msg_ID = 0x12;
Tx.Rtr = 0;
Tx.Msg_len = 4;
Tx.Data[0] = 0x1A;
Tx.Data[1] = 0xAB;
Tx.Data[2] = 0x22;
Tx.Data[3] = 0x4D;

ret = JNMMCANTx(device_handle,&Tx);

if(ret != 0)
{
	printf("JNMMCANTx failure \n");
}

Last updated