Author Topic: Calling subroutines  (Read 1191 times)

0 Members and 1 Guest are viewing this topic.

Offline maxwell

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 20
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

Offline panic mode

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 49
  • -Receive: 570
  • Posts: 3663
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: 20
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 ?

Offline panic mode

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 49
  • -Receive: 570
  • Posts: 3663
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: 24
  • -Receive: 723
  • Posts: 5566
Re: Calling subroutines
« Reply #4 on: January 13, 2017, 12:54:52 PM »

Offline maxwell

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

Offline grunftz

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 5
Re: Calling subroutines
« Reply #6 on: April 08, 2017, 03:55:05 PM »
it is not about calling subroutine, dont want to open new topic, but  i have a silly problem, log in as expert, type in the label name: and use GOTO to label name, but got error invalid block??? try to use LOOP same error??? any hint! thx in advance???

Offline SkyeFire

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 24
  • -Receive: 723
  • Posts: 5566
Re: Calling subroutines
« Reply #7 on: April 10, 2017, 02:37:38 PM »
You Selected the program instead of Opening it.  When Selected, any change made to the program is evaluated as soon as the cursor moves off the current line, which means that your LOOP has no ENDLOOP.  To edit a program, you need to use the OPEN button, not the SELECT button.