Ron_S

Sometimes seasoned programmers get stuck with a simple problem

4 posts in this topic

I was happily writing a program using an encoder for positioning and counting.

I wrote the first draft which I was sure was almost perfect except maybe for a few tweaks.

I have a test plc and hmi on my desk and simulated the operation of the machine on it.

All was going well until the program did something unusual - it set a coil where the line wasn't true???

I checked for double coils and all that but there were none

I even changed the coil number - but it still set it.

In fact I tried everything and gave it great thought while I was away from the program.

Then in a moment of enlightenment, it came to me. I'd probably spent 2/3 hours trying to fix my error.

Here it is: this doesn't work hehehe

I'm sure you will know why.

 

 

formic.png

Share this post


Link to post
Share on other sites

Well you checked for double coils. but did you also check on list for used devices so you find things like K4M60 which is also M65.

Share this post


Link to post
Share on other sites

Oh it was a right puzzler.

I tried using =>   =< and it either set without being true or.. wouldn't set when it was true.

I even just wrote that line in a separate program (with C235 permanently on via M8000 on another line)

I slowly turned the encoder I had connected to my set up until the figures in the equation were exactly the same with the same result.

 

Then aha... the counter is 32 bit so I used DMOV C235 D100 permanently on and used D100 instead of C235 in the compare.

Works as expected now.

Share this post


Link to post
Share on other sites
17 minutes ago, Ron_S said:

Then aha... the counter is 32 bit so I used DMOV C235 D100 permanently on and used D100 instead of C235 in the compare.

Works as expected now.

I've tripped on this before in Omron and Keyence. It seems the Japanese platforms will let you get away with anything. It lends to flexibility in programming but can get you sometimes.

With Omron's CX Programmer, I try to use Symbols where you can define the data type (size). This way you'll at least get a warning. Haven't used Mitsubishi in a while.

Edited by IO_Rack

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