Debugging help needed please

DL06

Member
Join Date
Feb 2006
Location
Canada
Posts
87
Hello all,

Can someone please look at the attached program to give me some help figuring out why one of my counts (the 'actual' count triggered by the sensor input) is zeroing itself out? Looks like it may be rolling over after 9999, but I haven't totally confirmed this.

I am not using a counter, but incrementing a register to do the counting (look in the interrupt routines). To handle the ten thousands digit and up I am incrementing the adjacent memory location each time the four least significant digits are zero (it should not happen the first time the interrupt is called, since the conditions are checked after the least significant word is incremented). Am I right in doing this, or will the 0000 9999 roll into 0001 0000 directly?

To give an idea of the physical setup, I have an Automation Direct DL06-DD1 hooked up to a C-more panel at each of three printing presses. The only inputs (3 total) are a single proximity sensor at each machine wired to high speed inputs X0, X1, and X2. The outputs (9 total) are a three level stack at each of the three presses. The run time is determined indirectly by using the time between pulses rather than tying into the machine (again see the program and the interrupts). You will notice that each section of the program is repeated three times (the comments and labels end with -1, -2, -3 to specify the machine number)

Please take a look and see if (i.e. where) I have made some errors. If any specific questions come up, I will be checking in and will get back to you shortly.

Thanks!
 
You might want to change the INC & conditional INC to a Double add (ADDD K1). I think the problem is that your code requires more then one scan. (the whole idea of the INT is that the input pulse might be shorter then the program scan time). If you use a ADDD K1 it V604 will automatically overflow into V605 without the need of the comparison contact to check for overflow & INC V605.

Maybe??
 
One thing I noticed is that you're using LDD and OUTD to reset the V600-V605 registers, but it looks like you're trying to reset single words.

LDD K0
OUTD V600

Will zero both V600 AND V601. Yet you ALSO have a OUTD V601. Realize that this will also zero the value in V602!... (n)

This might be the source of your 'mysterious' zeroing... :nodi:

Just eliminate the OUTD V601, OUTD V603, and OUTD V605 instructions.

🍻

-eric
 
My eyes ain't what they used to be...

elevmike said:
Good eye Eric,
Actually, you can thank DirectSOFT for spotting it. When I used FIND to locate other instances of V602, it pointed me to the LDD V601 (because it's a double instruction). I probably wouldn't have noticed the LDD over LD if DS hadn't pointed it out... :oops:

🍻

-Eric
 
Mike/Eric,

Thank you so much for the help! I think you guys hit the nail on the head!

What you have suggested makes total sense to me. I am now getting more familiar with the functions, but as you can see, repeating the program three times gets very tedious and eventually you quit thinking to a certain extent and just copy and paste away. I know that doing a LDD k0 into V600 will clear both V600 and V601, but blindly did a LDD to both instead of doing a LD to both, or a LDD to only the least significant word.

I was out at the presses today and everything was working fine. Before I left, I reset press two and press three mysteriously had problems with the counts. I went over to look at it and at the time he was around 10,000 cycles, so I thought it just rolled over to zero. After hearing your suggestions, I think what actualy happened was that I reset the four least significant bits on press 3. Obviously, I did not realize this at the time.

Sometimes it takes some 'outside eyes' to find the solution. I had an idea of what was wrong in my head (which turned out to be wrong) and that blinded me from seeing the actual problem.

Again, thanks a million! My head was starting to bleed from scratching it so much today.
 
DL06 said:
I was out at the presses today and everything was working fine. Before I left, I reset press two and press three mysteriously had problems with the counts. I went over to look at it and at the time he was around 10,000 cycles, so I thought it just rolled over to zero. After hearing your suggestions, I think what actualy happened was that I reset the four least significant bits on press 3.
I'll bet that's EXACTLY what happened... :nodi:

Glad I could help.

🍻

-Eric
 

Similar Topics

I have a mTV100 project connected to a CompactLogix processor via Etherenet. After some recent mods I'm getting a continual "PLC Comms Error"...
Replies
5
Views
2,822
Hi, I am trying to get the control program for a machine I'm working on debugged. There is one problem I can not seem to solve. The machine works...
Replies
18
Views
7,005
Hello everyone ! Can someone please tell me why the debug section is greyed out and how can I enable it ? Thank you in advance !
Replies
7
Views
2,814
hello, I've recently started using Logix Designer v30 as part of Studio 5000. I've written some code, and I'm trying to find a simulator for...
Replies
8
Views
4,197
Hello everyone ! Is there a way I can monitor what functions are used when a project starts ? For example could I print a message whenever a...
Replies
8
Views
3,649
Back
Top Bottom