Filling an S7 ARRAY

maslick

Member
Join Date
Apr 2011
Location
St. Petersburg
Posts
30
Hello guys!

I'm new to STEP7, so could you, please, help me with the following problem I face:

I need to write values from a current sensor into a data block (DB3) once an OB1 cycle. The process (high-current pulse) is very fast (45 ms) so i need to quickly get as much values as possible and write them to an array of REAL.

What I have come up with so far is that I got the current value and it's updated every scan cycle and stored in DB2. So I need to pick up this value and store in DB3 as an array item.

The problem is that I need to increment the array index and write the number (from DB2) to the next array item. I have no idea of how to do this. And basically, don't know how to work with arrays with a variable array index.

Could you please help me?


--
Pavel Maslov
R&D Institute for Electro-Physical Apparatus
St. Petersburg, Russia
 
You may be interested in the library function FC87 LIFO, which you can find in the standard library under TI-S7 converting blocks.
FC85 FIFO may be an alternative.
 
Thanks everyone!
I chose the FC_84 function, which adds data to an array.

JesperMP, you might have misunderstood - I need to form an array, not use its items. You did helped me though, cos had it not be you, i would not have even considered to use built in functions from the Standard Library :)
 
Great that I could be of help, despite that my suggestion was not exactly what you wanted.

I forgot to mention that these library blocks uses words, and not REALs (double-words). But I guess you have it figured out by now.
 
help!

Guys!

I thought that this would be easy. In fact the FC 84 block does not want to work whatsoever. I decided to run a simple test - write a value (W#16#44) using this function. Look what I've tried to do:


-------------------------------
1) I created DB3:
Code:
DB3.DBW 0    size      WORD    W#16#4        
DB3.DBX 2    values    WORD    W#16#2        
DB3.DBX 4    a1        WORD    W#16#23        
DB3.DBX 6    a2        WORD    W#16#24        
DB3.DBX 8    a3        WORD    W#16#00        
DB3.DBX 10   a4        WORD    W#16#00

2) I called the FC 84 block. The inputs of the block are as follows:
Code:
[FONT=Courier New]
DATA -  W#16#44
TABLE - P#DB3.DBX 0.0      
[/FONT]

3) As a result - the PLC goes SF. It doesn't update the DB3 data block. Strange.
-------------------------------

Anybody knows what's wrong?

 
Is FC84 loaded into the PLC?

Check your Diagnostic buffer for more information (CTRL + D)
 
Cycle time??

Hello again!
Thanks STL??? - I forgot to upload FC84, silly me =) Everything works fine.

I have another question. Are there any methods that can lessen the cycle time?

I made a DB, which consists of 5000 WORDs. The PLC cycle time is approximately 1ms (the maximum is 8ms) - so I'm writing values of a 5 second process with 1 to 8ms discretization, when in fact i need only ~46ms to catch.

Perhaps, the cycle buffer (ring buffer) would work faster than FC 84? Can I somehow decrease the cycle time, say, to 500 us or even less than that? Because as I've said earlier the process is very fast and I need as much values as possible.

I use a S7 313C controller and CP 342-5. Data is read from an ABB FOCS Fiber-Optic Current Sensor via Profibus at 10ms/78 samples speed. I measured (Ctrl-D) the cycle time of a simple communication via PROFIBUS (ABB->PLC), which equals ~1ms.

What do you guys think about that?
 
A 313C is not suited as a datalogger for anything less than 10 ms datalogging time.
The 10 ms is the shortest timed interrupt that can be configured.

I would find out what logging speed you need, and depending on that you find out which hardware you need to achieve that.
 

Similar Topics

I created a 13x2 array called Rack_Parts in RS5000. What is the correct syntax so I can MOV inually put in: Rack_Parts(Rack_Number...
Replies
6
Views
2,448
Hello All, I am trying to do something quite simple but not use to some of Twincat's instructions/syntax. I am programming in...
Replies
4
Views
21,175
Hey guys, We are facing an issue, Krones hotfill line, around 10-15 fillers out of 110 are overfilling the bottle. Please help us what can...
Replies
13
Views
572
Hi, I am just exploring the options to replace an outdated filling valve controller for a can filler. It has 78 filling valves and runs at max...
Replies
15
Views
4,566
Hi guys I am hoping you can help me. I want to use an Allen Bradley HMI and PLC to record information every time a Cask is filled to an SD drive...
Replies
8
Views
3,243
Back
Top Bottom