0
点赞
收藏
分享

微信扫一扫

ACS系列(12) LCI:激光器脉冲模式使用

小迁不秃头 2024-03-19 阅读 46

1)PWM模式测试LCI

int Mode1=0 ! Fixed parameters mode
real Freq1 =50000 ! Generated frequency
real Width1 =4e-3 ! Generated pulse width 4 us
real DutyCycle1=0 ! Duty Cycle parameter is not relevant in this mode
lc.SetSafetyMasks(1,1) ! Ignore LCI safety errors and faults
PWM_OFF:
lc.LaserDisable() ! Stop generate PWM
lc.Stop() ! Stops any previously initialized laser mode
PWM_ON: ! set all structure fields to default
lc.PowerPWMOut(Mode1,Freq1,Width1, DutyCycle1) ! Initialization of
! modulation function
lc.LaserEnable() ! Start PWM generation

STOP

2)一维固定距离脉冲模式

!signle axis back and forth moving
int AxX = 0 ! Actual moving X axis
lc.SetSafetyMasks(1,1) ! Ignore LCI safety errors and faults
ENABLE(AxX)
TILL MST(AxX).#ENABLED
PTP/ev (AxX), 0, 50
WAIT 100
CYCLE:
real PulseWidth1 = 0.0004 ! Generated pulse width 10 mS
real Interval1 = 0.01 ! interval between pulses = 1mm
real InitialPos
real StartPos1 
real StopPos
lc.LaserDisable() 
lc.Stop()
lc.SetMotionAxes(AxX) ! Axes 0,1 used for vector velocity calculation
lc.FixedDistPulse(PulseWidth1, Interval1)
! Initialization of Fixed Interval function
lc.LaserEnable() ! LCI ready to genarate pulses in motion
ptp/ev (AxX), 30, 50 ! motion command
WAIT 100
Interval1 = -0.01 ! interval between pulses = -5mm
InitialPos = APOS(AxX)
StartPos1 = 25
StopPos = 15
lc.LaserDisable() 
lc.Stop()
lc.SetMotionAxes(AxX) ! Axes 0,1 used for vector velocity calculation
lc.FixedDistPulse(PulseWidth1, Interval1,StartPos1, StopPos, InitialPos)
! Initialization of Fixed Interval function
lc.LaserEnable() ! LCI ready to genarate pulses in motion
PTP/ev (AxX), 0, 50
WAIT 100
GOTO CYCLE
STOP

3)二维固定距离脉冲模式

INT AxX = 0 ! Actual moving X axis
INT AxY = 1 ! Actual moving Y axis

REAL PulseWidth1 ! Generated pulse
REAL Interval1 ! interval between pulses
REAL XStartPos,YStartPos
REAL XStopPos, YStopPos
REAL PulseStartPos, PulseEndPos
lc.SetSafetyMasks(1,1) ! Ignore LCI safety errors and faults
ENABLE (AxX,AxY)
TILL ( MST(AxX).#ENABLED & MST(AxY).#ENABLED )
VEL(AxX)=10;ACC(AxX)=10*VEL(AxX);DEC(AxX)=10*VEL(AxX);KDEC(AxX)=10*ACC(AxX);JERK(AxX)=10*ACC(AxX)
CYCLE:
XStartPos = -10
YStartPos = -10
PTP/e (AxX,AxY), XStartPos,YStartPos !go to start position for X & Y
lc.Init()
PulseWidth1 = 0.05 ! Generated pulse width 5 mS
Interval1 = 0.1 ! interval between pulses = 1mm
XStopPos = 10
YStopPos = 10
PulseStartPos = 3
PulseEndPos = 26
lc.SetMotionAxes(AxX,AxY)
! Axes 0,1 used for vector velocity calculation
lc.FixedDistPulse(PulseWidth1, Interval1, PulseStartPos,PulseEndPos)
!! Initialization of 2D Fixed Interval function
lc.LaserEnable() ! LCI ready to generate pulses in motion
PTP/e (AxX,AxY), XStopPos,YStopPos
! Movement command during which pulses are issued.
XStopPos = -10
YStopPos = -10
lc.Init()
PulseWidth1 = 0.05 ! Generated pulse width 5 mS
Interval1 = 0.1 ! interval between pulses = 5mm
PulseStartPos = 3
PulseEndPos = 26
lc.SetMotionAxes(AxX,AxY)
! Axes 0,1 used for vector velocity calculation
lc.FixedDistPulse(PulseWidth1, Interval1, PulseStartPos,PulseEndPos)
!! Initialization of 2D Fixed Interval function
lc.LaserEnable() ! LCI ready to generate pulses in motion
PTP/e (AxX,AxY), XStopPos,YStopPos
! Movement command during which pulses are issued.
GOTO CYCLE
STOP

4)距离数组脉冲模式

int AxX = 0 ! Actual moving X axis
! auxiliary parameter used to initialize the position random array
global real Interval1=1e-3
global real StartPos1=6
global real EndPos1=11
global real PosArr(3000) ! position random array
global real WidthArr(3000) ! Array of generated pulses
global int SizeArr=3000 ! Array size
! auxiliary parameter used to initialize the position of random array
int kk=0
!AUTOEXEC:
! Position Array initialization
while kk<SizeArr
block
PosArr(kk)=StartPos1+kk*1.1*Interval1;kk=kk+1
end
end
fill (0.05,WidthArr) !All pulses are of the same width
DISTANCE_ARRAY_EX:
enable (AxX) ! enable X axis
till MST(AxX).#ENABLED
VEL(AxX)=10;ACC(AxX)=10*VEL(AxX);DEC(AxX)=10*VEL(AxX);KDEC(AxX)=10*ACC(AxX);JERK(AxX)=10*ACC(AxX)
CYCLE:
lc.Init() ! set LCI unit to default states
! the internal LCI resolution - optional feature
!lc.PosResolution = 1e-6
! Axes 0 used for vector velocity calculation
lc.SetMotionAxes(AxX)
ptp/e AxX, 0 ! go to start position for X axis
wait 100
! Initialization of Distance Array Pulse function
lc.DistanceArrPulse (PosArr, WidthArr, SizeArr)
lc.LaserEnable() ! Start generating pulses.
ptp/e AxX, 15 ! Movement command during which pulses are issued
wait 50
lc.Stop() ! Stops any previously initialized laser mode
ptp/ev AxX, 0, 50 ! go to start position for X axis
GOTO CYCLE
STOP

举报

相关推荐

0 条评论