BK8x00 - FB COM-Port

This function block can be used to connect (via the serial interface of the BXxxxx) the BK8000 serial Bus Coupler with RS485 and BK8100 with RS232 connection. The maximum baud rate is 38400 baud.

BK8x00 - FB COM-Port 1:
Function block FB_BX_BK8X00_master

VAR_INPUT

stCOMConfig       :ST_COMConfig;
byAddress         :BYTE;
byLen             :BYTE;
byMaxInputLen     :BYTE;
ptDataOut         :POINTER TO BYTE;
ptDataIN          :POINTER TO BYTE;
bStart            :BOOL;
TmOut             :TIME;

Legend

stComConfig: Structure for selecting the COM parameters
byAddress: BX8x00 address 1-98 (0 and 99 are reserved)
byLen: data length in [BYTES] (only even numbers are permitted, i.e. 0, 2, 4, ...)
byMaxInputLen: is connected with SIZEOF and the variable that is linked with ptDataIN
ptDataOut: is connected with ADR and data out
ptDataIn: is connected with ADR and data in
bStart: rising edge starts the function block
TMOut: delay until process is aborted 

VAR_OUTPUT

bBusy      :BOOL;
bError     :BOOL;
iErrorId   :WORD;
Input_len  :WORD;

Legend

bBusy: The function block is active as long it is TRUE.
bError: error bit
iErrorID: Error number
Input_Len: number of data that were received

 

Return parameter iErrorId

Meaning

0

No error

100dec

Error during opening of the COM port

101dec

Error during sending of data

102dec

Watchdog error, no response from the slave within the WD time

105dec

The input buffer is too small

200dec

CRC error

0x80xxhex

Bus Coupler error xx status byte of the Bus Coupler (see BX8x00 documentation)

Hardware

RS 232 communication PIN assignment

BX COM1 RS232

BX COM2 RS232

BK8100

2

8

2

3

7

3

5

5

5

RS485 communication PIN assignment

FB settings: When using the RS485 connection it is important that the stCOMConfig variable is set to 1 and that the COM2 interface is selected.

BX COM2 RS485

BK8000

1

3

6

8

ST example program

BK8x00 - FB COM-Port 2: Download (sample file)

Required material:

bk8x00_com2.prx