Codepark

is really plc runs in cycle?

4 posts in this topic

have a good day! and thanks for reading!

this is video when i start program (after 10second the Axis4 move couple of times : https://drive.google.com/file/d/1HNB07ZzH0-lBHFFwaRIhcSGUxp1m0XHz/view?usp=sharing

 

if you see the images that i attached you can see,

IF

test - afterConverData1 > 0.1

MC_MoveAbsolute4(Axis4~~

ElSE IF test - afterConverData1 < -0.1

MC_MoveAbsolute4(Axis4~~

 

if the plc run cycle ever 1ms, why that code don't executed every 1ms?

example, test - afterConverData1 this condition value go over like 10 or -10

but the condition > 0.1 or < - 0.1 dosen't figure it out to run the code "MC_MoveAbsolute4(Axis4~~)"

they just run code couple of times 

What am i do for this...?

 

KakaoTalk_Photo_2021-03-08-11-22-54.jpeg

Share this post


Link to post
Share on other sites

I have no servo experience, so can't comment specifically regarding the servo side of things.

However, looking at that code, I see that the variable bAxis4_Move has a value of "True" written to it at Line 4, again at Line 7 (in the IF statement, which should be true in that screenshot). Yet it is showing its current state as False.

If I have read the code correctly, the other spot that that bAxis4_Move has a value written to it is Line 11, however that IF statement would be False in that screenshot. So no value should be written from there.

So I have 2 questions:

1. What is the purpose of Line 4, if the same value is written to the variable bAxis4_Move in the IF Statements? Or why is it required in the IF Statements if the value is written at Line 4?

2. Is there somewhere in your code that is writing a value of False to the variable bAxis4_Move?

I don't know if that is the cause of your problem, however based on my limited PLC knowledge, that is where I would start the troubleshooting/debugging process.

Good Luck :-)

1 person likes this

Share this post


Link to post
Share on other sites

oh sorry for the poor description images haha:)

the line4 statement is just nothing while i am testing my plc just forgot to delete,

anyway the problem is that this machine might read all the code like loop,

but as you can see, the if condition statement doesnt work like loop,

i mean that if 0 -  (-3.602468) > 0.1 this case the servo_motor_move function have to work but nothing happen haha.. lol 

 

Q1. the line 4 has no meaning sorry for poor discription:)

Q2. yeah some other places the line4 statement says it false but in this case i set constant TRUE on servo move function :)

if you can see the picture that i attached i just thougth that the MOVEABSOLUTE is like just word absolute so i just changed it Relative but doesnt work haha....

thank you for replying!!

 

KakaoTalk_Photo_2021-03-08-16-06-17.jpeg

Edited by Codepark

Share this post


Link to post
Share on other sites

I don't know to be honest. Like I said, I don't have any experience with PLC servo programming so someone else will need to chime in. I suspect the problem is related to one of your other posts regarding Relative movement, so I would be taking what @scotty134 said in that other post and see what you come up with from that. https://forums.mrplc.com/index.php?/topic/40000-mc_moverelative-doesnt-work/&do=findComment&comment=183427

It looks like the IF statement on line 7 is working, because line 8 is writing the value to IRAxis4_Pos2. And the PLC will be running that IF statement every time it does a cycle (which you said was set at 1ms).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now