Author Topic: Calling subroutines  (Read 212 times)

0 Members and 1 Guest are viewing this topic.

Offline maxwell

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
Calling subroutines
« on: January 11, 2017, 10:00:39 PM »
Hello guys i have a question. Im Not really experienced in Programming robots.
I have a krc4 Robot
My Question is How do i call a subroutine Programme
I made a Little Programm with Signals inside that always Need to be active. But its Seams its Not working.
 For Exempel:
If gun_empty=true
Then
MotorOn=TRUE
AirOn=TRUE
Eindif
If gun_full=true 
Then
MotorOn= false
AirOn=False
EndIF
 Thanks in advance

Online panic mode

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 40
  • -Receive: 416
  • Posts: 2807
Re: Calling subroutines
« Reply #1 on: January 12, 2017, 01:33:32 AM »
typing code is reserved for expert level for a reason - if you are going to type code, you better follow correct syntax.
a) IF and THEN must be in same line,
b) single equal sign is assignment, double equal sign is comparison
c) your example has no subroutines

1) http://www.robot-forum.com/robotforum/kuka-robot-forum/read-first/
2) if you want reply about robot, post it in forum
3) read 1 and 2

Offline maxwell

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
Re: Calling subroutines
« Reply #2 on: January 12, 2017, 05:25:31 AM »
Thanks for the reply panic Mode.
What exactly is missing for it to be a subroutine. Or Are their Manuals and tips on How to Programme in subroutine ?

Online panic mode

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 40
  • -Receive: 416
  • Posts: 2807
Re: Calling subroutines
« Reply #3 on: January 13, 2017, 12:07:52 AM »
Code: [Select]
DEF Prog()
  Sub()  ; this line calls subroutine first time
  WAIT SEC 5
  Sub() ; this line calls subroutine second time
END

; code below is a subroutine
DEF Sub()
  $OUT[1] = NOT $OUT[1]
  WAIT SEC 2
END
1) http://www.robot-forum.com/robotforum/kuka-robot-forum/read-first/
2) if you want reply about robot, post it in forum
3) read 1 and 2

Offline SkyeFire

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 19
  • -Receive: 617
  • Posts: 4904
Re: Calling subroutines
« Reply #4 on: January 13, 2017, 12:54:52 PM »

Offline maxwell

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
Re: Calling subroutines
« Reply #5 on: January 14, 2017, 04:31:59 PM »
Thank you very much guys !!