Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: Controls Guy on March 25, 2020, 02:27:05 PM

Title: W315 Clocked/edged instruction (Leading Edge One-Shot Contact) used within loop
Post by: Controls Guy on March 25, 2020, 02:27:05 PM
I got a W315 for putting an OSR inside a loop.  I think what DM is going to do is that on the first PLC scan in which X39 is true, ANDPD X39 will be true for all the loop iterations that occur during that PLC scan (all of them unless I allow it to yield).  Is that correct?  If so, that's what I want it to do, and I'll disable the warning for that instance.
Title: Re: W315 Clocked/edged instruction (Leading Edge One-Shot Contact) used within loop
Post by: BobO on March 25, 2020, 02:40:20 PM
Would have to see the code to make sure I'm understanding, but it will only be true until the instruction is invoked again. If the instruction is in the loop, it would only be true during the first pass through the loop.
Title: Re: W315 Clocked/edged instruction (Leading Edge One-Shot Contact) used within loop
Post by: Controls Guy on March 25, 2020, 02:51:00 PM
This is inside a loop that iterates about 20 times without yielding:

Code: [Select]
STRE MHR[V0] LightingModePhot
ANDPD X39
MATH DST511 "1" "MC[300 + ((V0 - 1) / 3)]"
Title: Re: W315 Clocked/edged instruction (Leading Edge One-Shot Contact) used within loop
Post by: BobO on March 25, 2020, 02:52:02 PM
Will only be true the first pass through the loop.
Title: Re: W315 Clocked/edged instruction (Leading Edge One-Shot Contact) used within loop
Post by: Controls Guy on March 25, 2020, 02:53:53 PM
Will only be true the first pass through the loop.

Ah OK.  Will do AND X39 ANDN MyMemoryBit inside and set MMB equal to X39 after the loop.