beautypg.com

3 vci_get_canstatus, Vci_get_canstatus – B&B Electronics I-7565-H2 - Manual User Manual

Page 46

background image

5.5.3 VCI_Get_CANStatus

This function is used to get the assigned CAN port status.


Syntax :

int

VCI_Get_CANStatus (

BYTE

CAN_No,

PVCI_CAN_STATUS

pCANStatus

);

Parameter :
CAN_No:

[in] The assigned CAN port number.

pCANStatus:

[out] A structure pointer of _VCI_CAN_STATUS is used to receive the

CAN port status shown as below.

typedef struct _VCI_CAN_STATUS{

DWORD CurCANBaud;
BYTE CANReg;
BYTE CANTxErrCnt;
BYTE CANRxErrCnt;
BYTE MODState;
DWORD Reserved;

} _VCI_CAN_STATUS, *PVCI_CAN_STATUS;

CurCANBaud : Return the assigned CAN port baud rate
CANReg : Return the assigned CAN port register value
CANTxErrCnt : Return the assigned CAN port Tx error count
CANRxErrCnt : Return the assigned CAN port Rx error count
MODState

:

Return the module state

Return Values :
Return 0 means success, others means failure.

Examples :
Int Ret;
BYTE CAN_No, Module_State;
_VCI_CAN_STATUS CANSTA;

CAN_No=1;
Ret = VCI_Get_CANStatus(CAN_No, &CANSTA); // Get CAN port status
Module_State = CANSTA.MODState;

I-7565-H1/H2 High Speed USB/CAN Converter User’s Manual (Ver 1.1, Nov/2009) ------------- 46