"Can anyone help me" sister thread

Can't figure out how you increment the loop.......

It's actually a very sneaky way you're using there.

I'll say no more and let manmeetvirdi search a bit more
L D[AR2,P#0.0] mind PM'ing me how you reset and increment the loop?
 
Attached is a S7-300 project that flashes Q0.0 and has been run using PLC-SIM.
Which block would I need to modify and what would be the required changes to flash Q0.1 instead ?

Answer:In all the FC except FC1 do the following:
AN [AR1,P#0.1]
= [AR1,P#0.1]

Analysis:Fishy all the way.Lots of doubts.To explain if I will write first line of OB as BE. Now all the FC's from 1 to 20 has same code.All the FC's are being called through OB121 one after another except FC1.
So in OB121 I can change from existing
UC FC [#iJ] to
UC FC 3
and Q0.1 will still blink.

OB121 is called since first line of FB1 says: opn DB2
which does not exist hence OB121 is called upon with error
H#16#3A decimal equivalent of which is 58.
The manual of OB121 says H#16#3A means Access to a DB that has not been loaded!!

If we remove the instruction OPN DB2 from FB1 then we have to replace the 58 with 56 and q0.1 will still blink.Hexadecimal equivalent of which is 38 explanation of which in OB121 is not available.
So there is a another instruction which is calling Ob121 and that is CDB.



Is it right L D[AR2,P#0.0]??
 
Last edited:
Almost there.

Code:
      L     #OB121_PRG_ADDR
      L     58
      ==I

This code is checking the address at which the programming error occurred so it will only call FC2..15 once every flash. The fact that you edited FB1 and removed OPN DB2 meant the adress at which the error occured changed to 56

When FC2..FC15 are called in the loop, the value of the accumulator prior to the call will be 2..15 (UC FC does not modify the acumulators)
The code in each FC compares the accumulator with 15 and if it is 15, it copies QB0 to local memory, toggles local memory using the following:

Code:
AN [AR1,P#0.0]
= [AR1,P#0.0]

and then copies local memeory back to QB0.
It is only FC15 that is toggling Q0.0

All FC's except FC15 copy local memory to local memory, toggle local memory and then copy local memory back to local memory (thereby not flashing Q0.0)

The next holiday puzzle is in preparation :D
 
Hi there
Glad that I came prety close.

Yes its only FC15 where you have to write
AN [AR1,P#0.1]
= [AR1,P#0.1]

As you said all FC's except FC15 is maping Local memory into Local(86000000 in AR1 from this line "LAR1 #dwData") and hence there is no blinking of output. But this can be converted into 82000000 by by-passing "= [AR1,P#0.2]" after NOT and q0.0 starts blinking even if FC15 remains un edited!!

I have great doubt which Iam not able to frame up. Will ask tomorrow.
New Puzzle !!:geek:
 
Hi there L D[AR2,P#0.0]
Am I right in above said analysis??

If right then I feel back to square one as Iam unable to understand what makes the Q0.1 blink in the program attached :eek:
 
As you said all FC's except FC15 is mapping Local memory into Local(86000000 in AR1 from this line "LAR1 #dwData") and hence there is no blinking of output. But this can be converted into 82000000 by by-passing "= [AR1,P#0.2]" after NOT and q0.0 starts blinking even if FC15 remains un edited!!

What are you editing if FC15 remains un-edited :confused:

In your supplied project, OB121 stll has a loop counting from 19 to 1 but now you are only calling FC3.
Each time FC3 is called the accumulator will be 20,19,18, etc. so the one time the accumulator=15 the processing will then flash Q0.1
In the original project, FC20, FC19 etc were being called in OB121 and the accumulator will only match 15 in FC15.
 
OK
In FC3 of above project do the following changes
Replace "LAR1 #dwData" with
L #dwData
LAR1
Now when you see it online its local memory into local memory.
Is it because out of 19 times FC3 is called its only one time its actually blinking Q0.1, when acc1=15??

l1.GIF
 
Cool Thank you
Ok
Now if FB1 has nothing to do except calling OB121 then why does
if I by-pass following in FB1, does Q0.1 stops blinking??
AN #bFlasher
= #bFlasher

Even changing the location of these instruction does not help.
 
It is these two instructions that are causing OB121 to be called, so if you skip around them OB121 will not be called and hence no flashing. Have a look below, when the instructions are executed, there is no instance DB open (due to the CDB instruction), and as bFlasher belongs to the STAT area of the FB, the instruction will attempt to access the non-existant instance DB generating the OB121 call.
Check the diagnostic buffer and you will see two entries repeating themselves at addresses 56 and 60. If you want to see where in the block the addresses are, use the open block button and the block will open with the cursor at the errant address.

flash007.jpg

flash008.jpg
 
Got the point !!
Delighted.Thanks.
Yes now I can understand the scenario.
As I said changing the location of
CDB
AN #bFlasher
= #bFlasher
was not making the Q0.0 to flash, that's because of different module address being generated and FC's not being called. If I put the correct module address for comparison instruction Q0.0 starts blinking.Similarly only one instruction "OPN DB 2" in FB1 is sufficient to blink Q0.0.

Thank you very much.
 

Similar Topics

I have an old Sentry Palletizer (S/O Number 3007 / Serial Number 1172) that has lost its program as the backup battery died years ago. I can...
Replies
0
Views
106
this a program to send data to barcode printer I want to integrate a new printer in a new machine and i wanted to adapt the old prgram on it but I...
Replies
4
Views
175
I have an old PLC (circa 2007) consisting of Telemecanique/Modicon/Schneider Electric devices. The system has developed errors and unfortunately...
Replies
2
Views
255
Replies
49
Views
10,842
Hello, I am trying to figure out how to create / write / delete a .csv file on the SD card of an Allen Bradley PLC. There is a sample project...
Replies
1
Views
1,443
Back
Top Bottom