|
|
|
Bean
BDLC
|
BDLC serial communication
Methods are user callable functions/subroutines that are means of controlling the bean functions.
|
Methods:
-
Enable
- Enables the bean operation.
ANSIC prototype: byte Enable(void)
- Return value:byte - Error code, possible codes:
ERR_OK - OK ERR_SPEED - This device does not work in the active speed mode.
-
Disable
- Disables the bean operation.
ANSIC prototype: byte Disable(void)
- Return value:byte - Error code, possible codes:
ERR_OK - OK ERR_SPEED - This device does not work in the active speed mode.
-
EnableEvent
- This method enables the event(s).
ANSIC prototype: byte EnableEvent(void)
- Return value:byte - Error code, possible codes:
ERR_OK - OK ERR_SPEED - This device does not work in the active speed mode.
-
DisableEvent
- This method disables the event(s).
ANSIC prototype: byte DisableEvent(void)
- Return value:byte - Error code, possible codes:
ERR_OK - OK ERR_SPEED - This device does not work in the active speed mode.
-
SendBlock
- This method sends the block of bytes specified by its parameters. No additional buffer is used so the user must not change the data before the end of transmission, which is indicated by the OnTransmitData event. Status of the finished transmission can be obtained by the GetError method.
ANSIC prototype: byte SendBlock(byte *Data,word Length)
- Data: Pointer to byte - Pointer to data
- Length:word - Length of the data block in bytes (number of bytes should not exceed 12 bytes for J1850 protocol)
- Return value:byte - Error code, possible codes:
ERR_OK - OK ERR_SPEED - This device does not work in the active speed mode. ERR_TXFULL - Transmitting of the previous message is not finished yet.
-
RecvBlock
- This method reads a block of bytes from the input data buffer (see "Input data buffer size" property). In case of the ERR_OVERRUN error, the data are returned. In case of another error, no data are returned.
ANSIC prototype: byte RecvBlock(byte *Data,word Size,word *Length)
- Data: Pointer to byte - Pointer to the buffer for received data
- Size:word - Size of the buffer
- Length: Pointer to word - Length of the received block (for J1850 protocol number of bytes should not exceed 12 bytes)
- Return value:byte - Error code, possible codes:
ERR_OK - OK ERR_SPEED - This device does not work in the active speed mode. ERR_COMMON - A communication error occurred. Particular error can be analyzed by the GetError method. ERR_OVERRUN - Receive buffer overflow. ERR_RXEMPTY - Receive buffer is empty.
-
RecvChar
- If there are any data received, the method returns one byte from the input buffer. To receive a complete message use the ReceiveBlock method instead.
ANSIC prototype: byte RecvChar(byte *Chr)
- Chr: Pointer to byte - Poiter to a received character
- Return value:byte - Error code, possible codes:
ERR_OK - OK ERR_SPEED - This device does not work in the active speed mode. ERR_COMMON - A communication error occurred. The particular error type can be determined with the GetError method. ERR_OVERRUN - Receive buffer overflow. ERR_RXEMPTY - Receive buffer is empty.
-
SetIFR
- Sets the IFR data that are transmitted as a response to a received message. Method should be called before the receiving of the message starts. No additional buffer is used, therefore the user must not change the data before the received frame end indicated by OnReceiveData event. This method is enabled only if the IFR type property is not set to "No IFR" and at the same time a non-zero IFR buffer size is set.
ANSIC prototype: byte SetIFR(word Length,byte *Data)
- Length:word - Length of the frame
- Data: Pointer to byte - Pointer to IFR data
- Return value:byte - Error code, possible codes:
ERR_OK - OK ERR_SPEED - This device does not work in the active speed mode. ERR_RANGE - Number of IFR bytes does not correspond to selected IFR type.
-
RecvIFR
- This method reads the IFR (In-Frame Response) data from the input IFR buffer (see "Input IFR buffer size" property). In case of the ERR_OVERRUN error, the data are returned. In case of another error, no data are returned. This method is enabled only if a non-zero IFR buffer size is set.
ANSIC prototype: byte RecvIFR(byte *Data,word Size,word *Length)
- Data: Pointer to byte - Pointer to the buffer for received IFR data.
- Size:word - Size of the buffer (1. parameter)
- Length: Pointer to word - Length of the received IFR block (for J1850 protocol number of bytes should not exceed 12 bytes)
- Return value:byte - Error code, possible codes:
ERR_OK - OK ERR_SPEED - This device does not work in the active speed mode. ERR_COMMON - A communication error has occurred. The particular error type can be determined by calling the GetError method. ERR_OVERRUN - Receive IFR buffer overflow. ERR_RXEMPTY - Receive IFR buffer is empty.
-
GetCharsInRxBuf
- This Method returns number of characters in the receive buffer.
ANSIC prototype: word GetCharsInRxBuf(void)
- Return value:word - A number of bytes in the receive buffer
-
GetCharsInIFRbuf
- Method returns number of bytes in the IFR buffer.
ANSIC prototype: word GetCharsInIFRbuf(void)
- Return value:word - Number of bytes in IFR (In-Frame Response) buffer
-
ClearRxBuf
- Clears the receive buffer.
ANSIC prototype: byte ClearRxBuf(void)
- Return value:byte - Error code, possible codes:
ERR_OK - OK ERR_SPEED - This device does not work in the active speed mode.
-
ClearIFRbuf
- Clears the receive IFR buffer. This method is enabled only if a non-zero input IFR buffer size is defined.
ANSIC prototype: byte ClearIFRbuf(void)
- Return value:byte - Error code, possible codes:
ERR_OK - OK ERR_SPEED - This device does not work in the active speed mode.
-
GetError
- This method returns an error flags.
ANSIC prototype: byte GetError(BeanName_TError *Err)
- Err: Pointer to BeanName_TError - Returns structure containing error flags.
- Return value:byte - Error code, possible codes:
ERR_OK - OK ERR_SPEED - This device does not work in the active speed mode.
-
IgnoreMessage
- Method sets an ignore message flag to cancel reception of the rest of the message. (see the OnRxChar event). The flag is cleared automatically by the start of a new frame reception.
ANSIC prototype: byte IgnoreMessage(void)
- Return value:byte - Error code, possible codes:
ERR_OK - OK ERR_SPEED - This device does not work in the active speed mode. ERR_BUSY - Transmission is in progress. Message cannot be ignored.
-
Set4xSpeed
- Method sets the data transfer rate to be 4 times higher. In this mode the transmission is disabled (only the reception is available).
ANSIC prototype: byte Set4xSpeed(bool Speed)
- Speed:bool - TRUE = 4x speed, FALSE = normal speed
- Return value:byte - Error code, possible codes:
ERR_OK - OK ERR_SPEED - This device does not work in the active speed mode.
-
SetLoopbackMode
- This method sets the device into the loopback mode. In the digital loopback mode the receive pin is internally connected to the transmit pin.
ANSIC prototype: byte SetLoopbackMode(byte Mode)
- Mode:byte - 0 - no loopback
1 - analog loopback 2 - digital loopback 3 - both, analog and digital loopback
- Return value:byte - Error code, possible codes:
ERR_OK - OK ERR_SPEED - This device does not work in the active speed mode. ERR_RANGE - Parameter is out of range.
Note: Some methods can be implemented as macros.
|
|
|
Processor ExpertTM and Embedded BeansTM are registered trademarks of UNIS, Ltd.
©1997-2005, UNIS, Ltd.
|
|
|