Dallas Semiconductor DS80C400 C Libraries Home Page

Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals

Data Access module


Functions

int8_t can_sendframe (uint8_t CAN_No, CanFrame *frame)
 Transmits a data or RFR frame.
int8_t can_getrxmessagecenter (uint8_t CAN_No, MCConfig *config)
 Gets the first available message centre and configure it for reception.
int8_t can_receiveframesavailable (uint8_t CAN_No)
 Gets the number of frames rending in the receive buffer.
int8_t can_receiveframe (uint8_t CAN_No, CanFrame *frame)
 Gets a frame from the receive buffer.
int8_t can_getautoanswerrfrmessagecenter (uint8_t CAN_No, CanFrame *frame)
 Gets the first available message centre and configure it for Auto-answering Remote RFRs.
int16_t can_gettxerrorcount (uint8_t CAN_No)
 Gets the transmitter error count.
int16_t can_getrxerrorcount (uint8_t CAN_No)
 Gets the receiver error count.


Function Documentation

int8_t can_getautoanswerrfrmessagecenter uint8_t  CAN_No,
CanFrame frame
 

Gets the first available message centre and configure it for Auto-answering Remote RFRs.

Gets the first available message centre and configure it for Auto-answering Remote RFRs. Once enabled, that message center keeps waiting for incoming messages matching the configuration and auto-responds. If the user needs to enable MEME or MDME, then it will have to be done manually after disabling the message center, doing the changes and then re-enabling it. This function returns the Message center number. If there is no free message center, then it returns error CAN_ERROR_NOFREEMC.

Parameters:
CAN_No - CAN Port number (0 for DS80C400, 0 or 1 for DS80C390)
frame - Pointer to frame that has to be sent as response.
Returns:
Message center number 1 to 14 - if successful.

CAN_ERROR_ARGUMENT - if improper argument.

CAN_ERROR_NOT_INITIALIZED - if CAN controller is not initialized (can_init() has not been called).

CAN_ERROR_NOFREEMC - if free message center is available.

int16_t can_getrxerrorcount uint8_t  CAN_No  ) 
 

Gets the receiver error count.

Gets the receiver error count.

Parameters:
CAN_No - CAN Port number (0 for DS80C400, 0 or 1 for DS80C390)
Returns:
CAN_ERROR_NOERROR - if successful.

CAN_ERROR_ARGUMENT - if improper argument.

CAN_ERROR_NOT_INITIALIZED - if CAN controller is not initialized (can_init() has not been called).

int8_t can_getrxmessagecenter uint8_t  CAN_No,
MCConfig config
 

Gets the first available message centre and configure it for reception.

Gets the first available message centre and configure it for reception according to the parameters specified by the config. Then that message center keeps waiting for incoming messages matching the configuration, which will then be put into the Receive buffer. This function returns the Message center number. If there is no free message center, then it returns error CAN_ERROR_NOFREEMC.

Parameters:
CAN_No - CAN Port number (0 for DS80C400, 0 or 1 for DS80C390)
config - Pointer to MCConfig structure.
Returns:
Message center number 1 to 14 - if successful.

CAN_ERROR_ARGUMENT - if improper argument.

CAN_ERROR_NOT_INITIALIZED - if CAN controller is not initialized (can_init() has not been called).

CAN_ERROR_NOFREEMC - if free message center is available.

int16_t can_gettxerrorcount uint8_t  CAN_No  ) 
 

Gets the transmitter error count.

Gets the transmitter error count.

Parameters:
CAN_No - CAN Port number (0 for DS80C400, 0 or 1 for DS80C390)
Returns:
CAN_ERROR_NOERROR - if successful.

CAN_ERROR_ARGUMENT - if improper argument.

CAN_ERROR_NOT_INITIALIZED - if CAN controller is not initialized (can_init() has not been called).

int8_t can_receiveframe uint8_t  CAN_No,
CanFrame frame
 

Gets a frame from the receive buffer.

Gets a frame from the receive buffer. Returns CAN_ERROR_BUFEMPTY if the receive buffer doesn't contain any frames. Even if it returns CAN_ERROR_FRAMESDROPPED, it returns the valid frame from the receive buffer.

Parameters:
CAN_No - CAN Port number (0 for DS80C400, 0 or 1 for DS80C390)
frame - Pointer to CanFrame structure to hold the received frame.
Returns:
CAN_ERROR_NOERROR - if successful.

CAN_ERROR_ARGUMENT - if improper argument.

CAN_ERROR_NOT_INITIALIZED - if CAN controller is not initialized (can_init() has not been called).

CAN_ERROR_BUFEMPTY - if receive buffer is empty.

CAN_ERROR_FRAMESDROPPED - if one or more frames had been dropped.

int8_t can_receiveframesavailable uint8_t  CAN_No  ) 
 

Gets the number of frames rending in the receive buffer.

Gets the number of frames rending in the receive buffer. Returns Zero if no message is pending.

Parameters:
CAN_No - CAN Port number (0 for DS80C400, 0 or 1 for DS80C390)
Returns:
Number of frames in the receive queue - if successful.

CAN_ERROR_ARGUMENT - if improper argument.

CAN_ERROR_NOT_INITIALIZED - if CAN controller is not initialized (can_init() has not been called).

int8_t can_sendframe uint8_t  CAN_No,
CanFrame frame
 

Transmits a data or RFR frame.

Transmits a data or RFR frame through the first available message center. If no message center is available, it then enqueues the frame into the Transmit buffer. If buffer if full, then it returns CAN_ERROR_BUFFULL. If a previous transmission has an error, then it returns the appropriate error codes.

Parameters:
CAN_No - CAN Port number (0 for DS80C400, 0 or 1 for DS80C390)
frame - Pointer to CanFrame structure to be transmitted.
Returns:
CAN_ERROR_NOERROR - if successful.

CAN_ERROR_ARGUMENT - if improper argument.

CAN_ERROR_NOT_INITIALIZED - if CAN controller is not initialized (can_init() has not been called).

CAN_ERROR_PORT_DISABLED - If the CAN port is not enabled.

CAN_ERROR_BUFFULL - if transmit buffer is full.

transmit error code - if transmit error has occured.


Copyright 2005 Dallas Semiconductor, Inc.. Documentation generated by Doxygen.