Home› Troubleshooting
Discussion
Back to discussions page
tom24
Posts: 53 Apprentice
Use timer with 5.9 polyscope |
31 views
|
Answered | |
/ Most recent by tom24 |
11 comments |

the Hass send signal to the robot two times with one signal M100. the first signal stay as input to the robot for 1 second and the second will stay for 3 second . so if i need only the second signal how i can use the timer. i tested may times but it is not work. i appreciated for the help
for instance i use like this before start
time=0
timer=false
main program
if DIO =true and time=1 sec
timer=false
else DIO=true and timer =3 sec
for instance i use like this before start
time=0
timer=false
main program
if DIO =true and time=1 sec
timer=false
else DIO=true and timer =3 sec
This way in your main code you can simply wait for the timer1 or timer2 to go to True, also does it stay high for exactly 1 second or 3 seconds or is there any variability? You may need to monitor the state of time and see if sometimes it's slightly less than 1 or 3 for example.
Also, once you get the timer1 or timer2 True condition you will need to reset them as the thread will not reset or else the main program will not have time to use them. YOu cold also add a wait statement at the end so that the code simply waits for the input to go high again and then resets the flags and goes back to the top of the loop, something like this.
if (time=> 1 and time < 1.5)
elif(time => 3):<br> timer2=true
should read
if (time >= 1 and time <1.5 ):
if (time >= 3):
timer2 =True
<i><b></b></i><b></b><br>
i tried but i have the issue to attach the screenshotit shows me Lexer exception on line 6446: if(time>=1 & timer-1<1.5)
if(time>=1 and time<1.5):
cannot use & and your second conditional is timer-1 which if that is how you typed it is a Boolean, you want time there
One machine will very briefly will send voltage to the end of cycle causing the robot to head to that CNC per the program.
looks at that input and waits for the input to be HI (ON) for more than 2 seconds. This would alleviate that millisecond signal we are seeing, being interpreted as end of cycle. this is while running the machine A. so, can you check the following program if it fix the problem
Doosan_MB running=false
Main Program
Loop
if Doosan_Ma=True and start=true .............(Machine A)
Doosan_MA_Running=True
statrt=false
Do acction
Doosan_MA_Running=False
if Doosan_MB=True .................................(Machine
Doosan_MA_Running=True
Do acction
Doosan_MA_Running=False
Else
waite=0.01
Thread
MA_End_Cycle=True and Doosan-MA Running=false
Doosan_MA_Running=True
Elseiif timer_1=True
Doosan_MA_Running=True
MB_End_Cycle=True and Doosan-MB_ Running=false
Doosan_MB_Running=True
Thread
if timer_1>=2
timer_stop
start =true
sync()
Event DIO=true
timer_1 start
sync()
Thread
thread monitorInput():
local timer_1 = False
while (true):
local time = 0
while (DI0):
time = time + 0.002
sync()
end
if (time >=1 and time &< 2):
timer_1 = True
end
while (not DI0):
sync()
end
timer_1 = False
end