Author Topic: Call Function question  (Read 12594 times)

cch1955

  • Full Member
  • Posts: 198
  • Automated Machine Systems Designer
    • View Profile
Call Function question
« on: December 28, 2007, 09:39:28 AM »
Here is a part of a program I am using:

if y = 10 then  A = 8000 : CALL 21: STEPMOVE 1,-19000,10 : D$ = "JS2" : y=0 : setlcd 0,1,chr$(1): R = 0 : DM[54] = 0 : setio maindrly 'this is for 2" wide x 3.5 Jbag hub
endif

When execting this the CALL 21 is done as expected, but when it returns from 21 it does not execute the STEPMOVE command.

Does the CALL retun to the next command within the IF THEN Statement or does it return to the next command after this loop ignoring the remaning commands within the loop?

Thanks

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Call Function question
« Reply #1 on: December 28, 2007, 01:09:24 PM »
Yes, the program would run the next statement after the CALL21. So the Stepmove should have been executed unless the stepper motor is already moving, then STEPMOVE command will be ignored until after it completes the current STEPMOVE.

You can verify if the program did go to the next statement by putting a  "PAUSE" statement after the SETMOVE statement to see if the program does pause after calling #21.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

cch1955

  • Full Member
  • Posts: 198
  • Automated Machine Systems Designer
    • View Profile
Re:Call Function question
« Reply #2 on: December 28, 2007, 03:19:37 PM »
I think the problem is that the STEPMOVE comman is being encountered before the previous move is completed.

As I understand it a STEPMOVE command is ignored until a previous STEPMOVE is completed. No buffering of STEPMOVE commands takes place, so the command is lost unless issued after the current move completes.

I will have to add a flag which checks the complete bit for the STEPMOVE command to prevent concurrent execution.