#This .INI file is also the HELP, MANUAL and HOW-TO file for mb2hal. #Load the modbus HAL userspace module as the examples below, #change to match your own HAL_MODULE_NAME and .ini file name #Using HAL_MODULE_NAME=mb2hal or nothing (default): loadusr -W mb2hal config=config_file.ini #Using HAL_MODULE_NAME=mymodule: loadusr -Wn mymodule mb2hal config=config_file.ini # ++++++++++++++++++++++++ # Common section # ++++++++++++++++++++++++ [MB2HAL_INIT] #OPTIONAL: Debug level of init and INI file parsing. # 0 = silent. # 1 = error messages (default). # 2 = OK confirmation messages. # 3 = debugging messages. # 4 = maximum debugging messages (only in transactions). INIT_DEBUG=0 #OPTIONAL: HAL module (component) name. Defaults to "mb2hal". HAL_MODULE_NAME=mb2hal #OPTIONAL: Insert a delay of "FLOAT seconds" between transactions in order #to not to have a lot of logging and facilitate the debugging. #Useful when using DEBUG=3 (NOT INIT_DEBUG=3) #It affects ALL transactions. #Use "0.0" for normal activity. SLOWDOWN=0.0 #REQUIRED: The number of total Modbus transactions. There is no maximum. TOTAL_TRANSACTIONS=1 # ++++++++++++++++++++++++ # Transactions # ++++++++++++++++++++++++ #One transaction section is required per transaction, starting at 00 and counting up sequentially. #If there is a new link (not transaction), you must provide the REQUIRED parameters 1st time. #Warning: Any OPTIONAL parameter not specified are copied from the previous transaction. [TRANSACTION_00] LINK_TYPE=serial SERIAL_PORT=/dev/ttyUSB0 SERIAL_BAUD=19200 #if LINK_TYPE=serial then REQUIRED (only 1st time). #if LINK_TYPE=tcp then IGNORED #Data bits. One of 5,6,7,8. #SERVO PARAMETER PN067 DEFAULT 8 SERIAL_BITS=8 #if LINK_TYPE=serial then REQUIRED (only 1st time). #if LINK_TYPE=tcp then IGNORED #Data parity. One of: even, odd, none. SERIAL_PARITY=none #if LINK_TYPE=serial then REQUIRED (only 1st time). #if LINK_TYPE=tcp then IGNORED #Stop bits. One of 1, 2. SERIAL_STOP=2 #if LINK_TYPE=serial then OPTIONAL: #if LINK_TYPE=tcp then IGNORED #Serial port delay between for this transaction only. #In ms. Defaults to 0. SERIAL_DELAY_MS=2 #REQUIRED (only 1st time). #Modbus slave number. MB_SLAVE_ID=1 #REQUIRED: The first element address. FIRST_ELEMENT=420 #REQUIRED unless PIN_NAMES is specified: The number of elements. #It is an error to specify both NELEMENTS and PIN_NAMES #The pin names will be sequential numbers e.g mb2hal.plcin.01 #NELEMENTS=4 #REQUIRED unless NELEMENTS is specified: A list of element names. #these names will be used for the pin names, e.g mb2hal.plcin.cycle_start #NOTE: there must be no white space characters in the list PIN_NAMES=speed #REQUIRED: Modbus transaction function code (see www.modbus.org specifications). # fnct_02_read_discrete_inputs (02 = 0x02) # fnct_03_read_holding_registers (03 = 0x03) # fnct_04_read_input_registers (04 = 0x04) # fnct_06_write_single_register (06 = 0x06) # fnct_15_write_multiple_coils (15 = 0x0F) # fnct_16_write_multiple_registers (16 = 0x10) # # Created pins: # fnct_02_read_discrete_inputs: # mb2hal.m.n (bit out) # fnct_03_read_holding_registers: # fnct_04_read_input_registers: # mb2hal.m.n.float (float out) # mb2hal.m.n.int (s32 out) # fnct_06_write_single_register: # mb2hal.m.n (float in) # NELEMENTS needs to be 1 or PIN_NAMES must contain just one name. # fnct_15_write_multiple_coils: # mb2hal.m.n (bit in) # fnct_16_write_multiple_registers: # mb2hal.m.n (float in) # # m = HAL_TX_NAME or transaction number if not set, n = element number (NELEMENTS) or name from PIN_NAMES # Example: mb2hal.00.01. (transaction=00, second register=01 (00 is the first one)) # mb2hal.TxName.01. (HAL_TX_NAME=TxName, second register=01 (00 is the first one)) MB_TX_CODE=fnct_03_read_holding_registers #OPTIONAL: Response timeout for this transaction. In INTEGER ms. Defaults to 500 ms. #This is how much to wait for 1st byte before raise an error. MB_RESPONSE_TIMEOUT_MS=100 #OPTIONAL: Byte timeout for this transaction. In INTEGER ms. Defaults to 500 ms. #This is how much to wait from byte to byte before raise an error. MB_BYTE_TIMEOUT_MS=100 #OPTIONAL: Instead of giving the transaction number, use a name. #Example: mb2hal.00.01 could become mb2hal.plcin.01 #The name must not exceed 28 characters. #NOTE: when using names be careful that you dont end up with two transactions #using the same name. HAL_TX_NAME=spindle_read #OPTIONAL: Maximum update rate in HZ. Defaults to 0.0 (0.0 = as soon as available = infinit). #NOTE: This is a maximum rate and the actual rate may be lower. #If you want to calculate it in ms use (1000 / required_ms). #Example: 100 ms = MAX_UPDATE_RATE=10.0, because 1000.0 ms / 100.0 ms = 10.0 Hz MAX_UPDATE_RATE=0.0 #OPTIONAL: Debug level for this transaction only. #See INIT_DEBUG parameter above. DEBUG=3