#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): #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. INIT_DEBUG=1 #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=2 #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=tcp TCP_IP=192.168.16.55 TCP_PORT=502 MB_SLAVE_ID=1 #FIRST_ELEMENT=5391 #NELEMENTS=8 #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_15_write_multiple_coils (15 = 0x0F) # fnct_16_write_multiple_registers (16 = 0x10) #fnct_02_read_discrete_inputs: creates boolean output HAL pins. #fnct_03_read_holding_registers: creates a floating point output HAL pins. # also creates a u32 output HAL pins. #fnct_04_read_input_registers: creates a floating point output HAL pins. # also creates a u32 output HAL pins. #fnct_15_write_multiple_coils: creates boolean input HAL pins. #fnct_16_write_multiple_registers: creates a floating point input HAL pins. #MB_TX_CODE=fnct_04_read_input_registers 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=500 #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=500 #OPTIONAL: Instead of giving the transaction number, use a name. #Example: mb2hal.00.01 could become mb2hal.plcin.01 #The name must not exceed 32 characters. #NOTE: when using names be careful that you dont end up with two transactions #usign the same name. HAL_TX_NAME=STBIn HAL_MAP_PIN=PowerOnSwitch, 5391, bit, 0 HAL_MAP_PIN=SpindleNormal, 5391, bit, 1 HAL_MAP_PIN=SpindleOff, 5391, bit, 2 HAL_MAP_PIN=SpindleReverse, 5391, bit, 3 HAL_MAP_PIN=TurretShift, 5391, bit, 4 HAL_MAP_PIN=CoolantReqOn, 5391, bit, 5 HAL_MAP_PIN=CoolantReqOff, 5391, bit, 6 HAL_MAP_PIN=CycleStart, 5391, bit, 7 HAL_MAP_PIN=FeedHoldbtn, 5391, bit, 8 HAL_MAP_PIN=EStop, 5391, bit, 9 HAL_MAP_PIN=XaxisMPG, 5391, bit, 10 HAL_MAP_PIN=ZaxisMPG, 5391, bit, 11 HAL_MAP_PIN=XplusJOG, 5391, bit, 12 HAL_MAP_PIN=XminusJog, 5391, bit, 13 HAL_MAP_PIN=ZplusJOG, 5391, bit, 14 HAL_MAP_PIN=ZminusJOG, 5391, bit, 15 HAL_MAP_PIN=ModeSelect-1, 5392, bit, 0 HAL_MAP_PIN=ModeSelect-2, 5392, bit, 1 HAL_MAP_PIN=ModeSelect-3, 5392, bit, 2 HAL_MAP_PIN=ModeSelect-4, 5392, bit, 3 HAL_MAP_PIN=TurretN-1, 5392, bit, 4 HAL_MAP_PIN=TurretN-2, 5392, bit, 5 HAL_MAP_PIN=TurretN-3, 5392, bit, 6 HAL_MAP_PIN=TurretN-4, 5392, bit, 7 HAL_MAP_PIN=FeedOv-1, 5392, bit, 8 HAL_MAP_PIN=FeedOv-2, 5392, bit, 9 HAL_MAP_PIN=FeedOv-3, 5392, bit, 10 HAL_MAP_PIN=FeedOv-4, 5392, bit, 11 HAL_MAP_PIN=RapidOv-1, 5392, bit, 12 HAL_MAP_PIN=RapidOv-2, 5392, bit, 13 HAL_MAP_PIN=MachineLock, 5392, bit, 14 HAL_MAP_PIN=DryRun, 5392, bit, 15 HAL_MAP_PIN=BlockDelete, 5393, bit, 0 HAL_MAP_PIN=OptStop, 5393, bit, 1 HAL_MAP_PIN=SingleBlock, 5393, bit, 2 HAL_MAP_PIN=FootSwitch1, 5393, bit, 3 HAL_MAP_PIN=FootSwitch2, 5393, bit, 4 HAL_MAP_PIN=ChuckInside, 5393, bit, 5 HAL_MAP_PIN=TurretLS9, 5394, bit, 0 HAL_MAP_PIN=TurretLS10, 5394, bit, 1 HAL_MAP_PIN=TurretLS11, 5394, bit, 2 HAL_MAP_PIN=TurretLS12, 5394, bit, 3 HAL_MAP_PIN=TurretLS13, 5394, bit, 4 HAL_MAP_PIN=TurretIndex, 5394, bit, 5 HAL_MAP_PIN=MachineError, 5395, bit, 0 HAL_MAP_PIN=MachineReadyFin, 5395, bit, 1 HAL_MAP_PIN=PressureSwitch, 5395, bit, 2 HAL_MAP_PIN=ChuckOpenLimit, 5395, bit, 3 HAL_MAP_PIN=ChuckCloseLimit, 5395, bit, 4 HAL_MAP_PIN=DoorSwitchs, 5395, bit, 5 HAL_MAP_PIN=SpindlePot, 5396, f16 #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=1 #While DEBUGGING transactions note the returned "ret[]" value correspond to: #/* Modbus protocol exceptions */ #ILLEGAL_FUNCTION -0x01 the FUNCTION code received in the query is not allowed or invalid. #ILLEGAL_DATA_ADDRESS -0x02 the DATA ADDRESS received in the query is not an allowable address for the slave or is invalid. #ILLEGAL_DATA_VALUE -0x03 a VALUE contained in the data query field is not an allowable value or is invalid. #SLAVE_DEVICE_FAILURE -0x04 SLAVE (or MASTER) device unrecoverable FAILUER while attemping to perform the requested action. #SERVER_FAILURE -0x04 (see above). #ACKNOWLEDGE -0x05 This response is returned to PREVENT A TIMEOUT in the master. # A long duration of time is required to process the request in the slave. #SLAVE_DEVICE_BUSY -0x06 The slave (or server) is BUSY. Retrasmit the request later. #SERVER_BUSY -0x06 (see above). #NEGATIVE_ACKNOWLEDGE -0x07 Unsuccessful programming request using function code 13 or 14. #MEMORY_PARITY_ERROR -0x08 SLAVE parity error in MEMORY. #GATEWAY_PROBLEM_PATH -0x0A (-10) Gateway path(s) not available. #GATEWAY_PROBLEM_TARGET -0x0B (-11) The target device failed to repond (generated by master, not slave). #/* Program or connection */ #COMM_TIME_OUT -0x0C (-12) #PORT_SOCKET_FAILURE -0x0D (-13) #SELECT_FAILURE -0x0E (-14) #TOO_MANY_DATAS -0x0F (-15) #INVALID_CRC -0x10 (-16) #INVALID_EXCEPTION_CODE -0x11 (-17 [TRANSACTION_01] MB_TX_CODE=fnct_16_write_multiple_registers HAL_TX_NAME=STBOut HAL_MAP_PIN=XZeroReturnLamp, 0, bit, 0 HAL_MAP_PIN=ZZeroReturnLamp, 0, bit, 1 HAL_MAP_PIN=MachineReadyLamp, 0, bit, 2 HAL_MAP_PIN=OptionnalStop, 0, bit, 3 HAL_MAP_PIN=FeedHoldLamp, 0, bit, 4 HAL_MAP_PIN=CycleStartLamp, 0, bit, 5 HAL_MAP_PIN=TurretIndexLamp, 0, bit, 6 HAL_MAP_PIN=CoolantPumpOnLamp, 0, bit, 7 HAL_MAP_PIN=CoolantPumpOffLamp, 0, bit, 8 HAL_MAP_PIN=ChuckClampLamp, 0, bit, 9 HAL_MAP_PIN=ProgramEndLamp, 0, bit, 10 HAL_MAP_PIN=ProgramErrorLamp, 0, bit, 11 HAL_MAP_PIN=MachineErrorLamp, 0, bit, 12 HAL_MAP_PIN=ServoReady, 0, bit, 13 HAL_MAP_PIN=CoolantPump, 0, bit, 14 HAL_MAP_PIN=DDO3705-16, 0, bit, 15 HAL_MAP_PIN=TurretUnclamp, 1, bit, 0 HAL_MAP_PIN=TurretClamp, 1, bit, 1 HAL_MAP_PIN=TurretReverse, 1, bit, 2 HAL_MAP_PIN=TurretIndex,1 , bit, 3 HAL_MAP_PIN=ChuckClose, 1, bit, 4 HAL_MAP_PIN=ChuckOpen, 1, bit, 5 HAL_MAP_PIN=MachineReady, 2, bit, 0 HAL_MAP_PIN=ServoPower, 2, bit, 1 HAL_MAP_PIN=HydraulicPump, 3, bit, 0 HAL_MAP_PIN=LubricationPump, 3, bit, 0 MAX_UPDATE_RATE=0.0 DEBUG=1