diff --git a/lcec.hal b/lcec.hal index 699e73d3f66c164db65b27c4c123e3fe23315b80..9f6cf30387bc3635155150189181b16e2d9c2afc 100755 --- a/lcec.hal +++ b/lcec.hal @@ -1,7 +1,8 @@ loadrt trivkins loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS -loadusr -W mb2hal config=mb2hal.ini +#loadusr -W mb2hal config=mb2hal.ini +loadusr -Wn mb2hal /home/electrolab/cnc/maurice/mb2halv2/mb2halv2 config=mb2hal.ini loadusr -W lcec_conf maurice.xml loadrt lcec diff --git a/maurice.hal b/maurice.hal index fdef01709056541ffae48e38e0367faa25ea4402..ab5b95fbf439af48ba98abcc584be0e212673401 100644 --- a/maurice.hal +++ b/maurice.hal @@ -61,7 +61,7 @@ net Z-posfb => joint.2.motor-pos-fb # Components declaration #========================================== -loadrt classicladder_rt +loadrt classicladder_rt numPhysInputs=50 numPhysOutputs=50 addf classicladder.0.refresh servo-thread loadusr classicladder maurice.clp diff --git a/mb2hal.hal b/mb2hal.hal index 75d6b90f1d5d6d09bcb26ad15ba083b13a1e7aa8..05912d3a9ace9dd0ab8e1e5aa70d4b30be54e0f9 100644 --- a/mb2hal.hal +++ b/mb2hal.hal @@ -1,151 +1,84 @@ -loadrt bitslice count=6 personality=16,16,6,6,6,2 -loadrt weighted_sum wsum_sizes=16,6,2,2 -loadrt conv_s32_float count=4 -loadrt conv_s32_u32 count=6 - -#loadusr -W mb2hal config=mb2hal.ini - -addf conv-s32-u32.0 servo-thread -addf conv-s32-u32.1 servo-thread -addf conv-s32-u32.2 servo-thread -addf conv-s32-u32.3 servo-thread -addf conv-s32-u32.4 servo-thread -addf conv-s32-u32.5 servo-thread -addf bitslice.0 servo-thread -addf bitslice.1 servo-thread -addf bitslice.2 servo-thread -addf bitslice.3 servo-thread -addf bitslice.4 servo-thread -addf bitslice.5 servo-thread -addf process_wsums servo-thread -addf conv-s32-float.0 servo-thread -addf conv-s32-float.1 servo-thread -addf conv-s32-float.2 servo-thread -addf conv-s32-float.3 servo-thread - - -#================================================== -#Slicing Register Inputs -#================================================== - -# mb2hal.STBin.00.int -net ConvSU0 mb2hal.STBIn.00.int => conv-s32-u32.0.in -net StbDDI3725-1 conv-s32-u32.0.out => bitslice.0.in -net ConvSU1 mb2hal.STBIn.01.int => conv-s32-u32.1.in -net StbDDI3725-2 conv-s32-u32.1.out => bitslice.1.in -net ConvSU2 mb2hal.STBIn.02.int => conv-s32-u32.2.in -net StbDDI3610-1 conv-s32-u32.2.out => bitslice.2.in -net ConvSU3 mb2hal.STBIn.03.int => conv-s32-u32.3.in -net StbDDO3610-2 conv-s32-u32.3.out => bitslice.3.in -net ConvSU4 mb2hal.STBIn.04.int => conv-s32-u32.4.in -net StbDDI3610-3 conv-s32-u32.4.out => bitslice.4.in -net ConvSU5 mb2hal.STBIn.05.int => conv-s32-u32.5.in -net StnDAI7220 conv-s32-u32.5.out => bitslice.5.in - - -net PowerOnSwitch bitslice.0.out-00 -net SpindleNormal bitslice.0.out-01 -net SpindleOff bitslice.0.out-02 -net SpindleReverse bitslice.0.out-03 -net TurretShift bitslice.0.out-04 -net CoolantReqOn bitslice.0.out-05 -net CoolantReqOff bitslice.0.out-06 -net CycleStart bitslice.0.out-07 -net FeedHoldbtn bitslice.0.out-08 -net EStop bitslice.0.out-09 -net XaxisMPG bitslice.0.out-10 -net YaxisMPG bitslice.0.out-11 -net XplusJOG bitslice.0.out-12 -net XminusJog bitslice.0.out-13 -net ZplusJOG bitslice.0.out-14 -net ZminusJOG bitslice.0.out-15 - -net ModeSelect-1 bitslice.1.out-00 -net ModeSelect-2 bitslice.1.out-01 -net ModeSelect-3 bitslice.1.out-02 -net ModeSelect-4 bitslice.1.out-03 -net TurretN-1 bitslice.1.out-04 -net TurretN-2 bitslice.1.out-05 -net TurretN-3 bitslice.1.out-06 -net TurretN-4 bitslice.1.out-07 -net FeedOv-1 bitslice.1.out-08 -net FeedOv-2 bitslice.1.out-09 -net FeedOv-3 bitslice.1.out-10 -net FeedOv-4 bitslice.1.out-11 -net RapidOv-1 bitslice.1.out-12 -net RapidOv-2 bitslice.1.out-13 -net MachineLock bitslice.1.out-14 -net DryRun bitslice.1.out-15 - -net BlockDelete bitslice.2.out-00 -net OptStop bitslice.2.out-01 -net SingleBlock bitslice.2.out-02 -net FootSwitch1 bitslice.2.out-03 -net FootSwitch2 bitslice.2.out-04 -net ChuckInside bitslice.2.out-05 - -net TurretLS9 bitslice.3.out-00 -net TurretLS10 bitslice.3.out-01 -net TurretLS11 bitslice.3.out-02 -net TurretLS12 bitslice.3.out-03 -net TurretLS13 bitslice.3.out-04 -net TurretIndex bitslice.3.out-05 - -net MachineError bitslice.4.out-00 -net MachineReadyFin bitslice.4.out-01 -net ChuckCloseFin bitslice.4.out-02 -net FeedHoldFin bitslice.4.out-03 -net SpindleIlk bitslice.4.out-04 -net StartIlk bitslice.4.out-05 - -net ChuckLm1 bitslice.5.out-00 -net ChuckLm2 bitslice.5.out-01 - -#================================================== -#Summing Register Outputs -#================================================== - -net PgmEnd wsum.0.bit.0.in -net SpindleAlarm wsum.0.bit.1.in -net XZeroReturnLamp wsum.0.bit.2.in -net ZZeroReturnLamp wsum.0.bit.3.in -net MachineReadyLamp wsum.0.bit.4.in -net OptionnalStop wsum.0.bit.5.in -net FeedHoldLamp wsum.0.bit.6.in -net CycleStartLamp wsum.0.bit.7.in -net TurretIndexLamp wsum.0.bit.8.in -net CoolantPumpOnLamp wsum.0.bit.9.in -net CoolantPumpOffLamp wsum.0.bit.10.in -net ChuckClampLamp wsum.0.bit.11.in -net ProgramEndLamp wsum.0.bit.12.in -net ProgramErrorLamp wsum.0.bit.13.in -net MachineErrorLamp wsum.0.bit.14.in -net ResetSignal wsum.0.bit.15.in - -net TurretUnclamp wsum.1.bit.0.in -net TurretClamp wsum.1.bit.1.in -net TurretReverse wsum.1.bit.2.in -net TurretIndex wsum.1.bit.3.in -net ChuckClose wsum.1.bit.4.in -net ChuckOpen wsum.1.bit.5.in - -net MachineReady wsum.2.bit.0.in -net ServoReady wsum.2.bit.1.in - -net CoolantPump wsum.3.bit.0.in - - - -net ConvWsum0 wsum.0.sum => conv-s32-float.0.in -net StbDDO3705 mb2hal.STBOut.00 <= conv-s32-float.0.out - -net ConvWsum1 wsum.1.sum => conv-s32-float.1.in -net StbDDO3600 mb2hal.STBOut.01 <= conv-s32-float.1.out - -net ConvWsum2 wsum.2.sum => conv-s32-float.2.in -net StbDRC3210-1 mb2hal.STBOut.02 <= conv-s32-float.2.out - -net ConvWsum3 wsum.3.sum => conv-s32-float.3.in -net StbDRC3210-2 mb2hal.STBOut.03 <= conv-s32-float.3.out - -#==================================================================== +#mb2hal.STBIn.PowerOnSwitch +#mb2hal.STBIn.SpindleNormal +#mb2hal.STBIn.SpindleOff +#mb2hal.STBIn.SpindleReverse +#mb2hal.STBIn.TurretShift +#mb2hal.STBIn.CoolantReqOn +#mb2hal.STBIn.CoolantReqOff +#mb2hal.STBIn.CycleStart +#mb2hal.STBIn.FeedHoldbtn +#mb2hal.STBIn.EStop +#mb2hal.STBIn.XaxisMPG0 +#mb2hal.STBIn.YaxisMPG1 +#mb2hal.STBIn.XplusJOG2 +#mb2hal.STBIn.XminusJog +#mb2hal.STBIn.ZplusJOG +#mb2hal.STBIn.ZminusJOG +# +#mb2hal.STBIn.ModeSelect-1 +#mb2hal.STBIn.ModeSelect-2 +#mb2hal.STBIn.ModeSelect-3 +#mb2hal.STBIn.ModeSelect-4 +#mb2hal.STBIn.TurretN-1 +#mb2hal.STBIn.TurretN-2 +#mb2hal.STBIn.TurretN-3 +#mb2hal.STBIn.TurretN-4 +#mb2hal.STBIn.FeedOv-1 +#mb2hal.STBIn.FeedOv-2 +#mb2hal.STBIn.FeedOv-3 +#mb2hal.STBIn.FeedOv-4 +#mb2hal.STBIn.RapidOv-1 +#mb2hal.STBIn.RapidOv-2 +#mb2hal.STBIn.MachineLock +#mb2hal.STBIn.DryRun +# +#mb2hal.STBIn.OptStop +#mb2hal.STBIn.SingleBlock +#mb2hal.STBIn.FootSwitch1 +#mb2hal.STBIn.BlockDelete +#mb2hal.STBIn.FootSwitch2 +#mb2hal.STBIn.ChuckInside +# +net TurretLS9 mb2hal.STBIn.TurretLS9 +net TurretLS10 mb2hal.STBIn.TurretLS10 +net TurretLS11 mb2hal.STBIn.TurretLS11 +net TurretLS12 mb2hal.STBIn.TurretLS12 +net TurretLS13 mb2hal.STBIn.TurretLS13 +net TurretIndex mb2hal.STBIn.TurretIndex +# +#mb2hal.STBIn.MachineError +#mb2hal.STBIn.MachineReadyFin +#mb2hal.STBIn.ChuckCloseFin +#mb2hal.STBIn.FeedHoldFin +#mb2hal.STBIn.SpindleIlk +#mb2hal.STBIn.StartIlk +# +#mb2hal.STBOut.PgmEnd +#mb2hal.STBOut.SpindleAlarm +#mb2hal.STBOut.XZeroReturnLamp +#mb2hal.STBOut.ZZeroReturnLamp +#mb2hal.STBOut.MachineReadyLamp +#mb2hal.STBOut.OptionnalStop +#mb2hal.STBOut.FeedHoldLamp +#mb2hal.STBOut.CycleStartLamp +#mb2hal.STBOut.TurretIndexLamp +#mb2hal.STBOut.CoolantPumpOnLamp +#mb2hal.STBOut.CoolantPumpOffLamp +#mb2hal.STBOut.ChuckClampLamp +#mb2hal.STBOut.ProgramEndLamp +#mb2hal.STBOut.ProgramErrorLamp +#mb2hal.STBOut.MachineErrorLamp +#mb2hal.STBOut.ResetSignal +# +#mb2hal.STBOut.TurretUnclamp +#mb2hal.STBOut.TurretClamp +#mb2hal.STBOut.TurretReverse +#mb2hal.STBOut.TurretIndex +#mb2hal.STBOut.ChuckClose +#mb2hal.STBOut.ChuckOpen +# +#mb2hal.STBOut.MachineReady +#mb2hal.STBOut.ServoReady +# +#mb2hal.STBOut.CoolantPump +# diff --git a/mb2hal.ini b/mb2hal.ini index d098ae0e2808980b076fa5db590694b2dba17e79..5dce295c6955d439b721992a32418eeaf56b9c4b 100644 --- a/mb2hal.ini +++ b/mb2hal.ini @@ -43,8 +43,8 @@ LINK_TYPE=tcp TCP_IP=192.168.16.55 TCP_PORT=502 MB_SLAVE_ID=1 -FIRST_ELEMENT=5391 -NELEMENTS=8 +#FIRST_ELEMENT=5391 +#NELEMENTS=8 #REQUIRED: Modbus transaction function code (see www.modbus.org specifications). # fnct_02_read_discrete_inputs (02 = 0x02) @@ -61,8 +61,8 @@ NELEMENTS=8 #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. @@ -78,9 +78,63 @@ MB_BYTE_TIMEOUT_MS=500 #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=YaxisMPG, 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=ChuckCloseFin, 5395, bit, 2 +HAL_MAP_PIN=FeedHoldFin, 5395, bit, 3 +HAL_MAP_PIN=SpindleIlk, 5395, bit, 4 +HAL_MAP_PIN=StartIlk, 5395, bit, 5 + #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). @@ -114,12 +168,42 @@ DEBUG=1 #SELECT_FAILURE -0x0E (-14) #TOO_MANY_DATAS -0x0F (-15) #INVALID_CRC -0x10 (-16) -#INVALID_EXCEPTION_CODE -0x11 (-17) +#INVALID_EXCEPTION_CODE -0x11 (-17 + [TRANSACTION_01] MB_TX_CODE=fnct_16_write_multiple_registers -FIRST_ELEMENT=0 -NELEMENTS=4 + HAL_TX_NAME=STBOut + +HAL_MAP_PIN=PgmEnd, 0, bit, 0 +HAL_MAP_PIN=SpindleAlarm, 0, bit, 1 +HAL_MAP_PIN=XZeroReturnLamp, 0, bit, 2 +HAL_MAP_PIN=ZZeroReturnLamp, 0, bit, 3 +HAL_MAP_PIN=MachineReadyLamp, 0, bit, 4 +HAL_MAP_PIN=OptionnalStop, 0, bit, 5 +HAL_MAP_PIN=FeedHoldLamp, 0, bit, 6 +HAL_MAP_PIN=CycleStartLamp, 0, bit, 7 +HAL_MAP_PIN=TurretIndexLamp, 0, bit, 8 +HAL_MAP_PIN=CoolantPumpOnLamp, 0, bit, 9 +HAL_MAP_PIN=CoolantPumpOffLamp, 0, bit, 10 +HAL_MAP_PIN=ChuckClampLamp, 0, bit, 11 +HAL_MAP_PIN=ProgramEndLamp, 0, bit, 12 +HAL_MAP_PIN=ProgramErrorLamp, 0, bit, 13 +HAL_MAP_PIN=MachineErrorLamp, 0, bit, 14 +HAL_MAP_PIN=ResetSignal, 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=ServoReady, 2, bit, 1 + +HAL_MAP_PIN=CoolantPump, 3, bit, 0 + MAX_UPDATE_RATE=0.0 DEBUG=1