Exporting source of STEP7 DB's

Pandiani

Lifetime Supporting Member
Join Date
Apr 2005
Location
Tz
Posts
718
Hello to all,

I have been trying to use Simon's code for exporting DB actual values to Excel spreadsheet.
Instead of bumping old thread , I'm starting a new one.

I have used his code, created OB34 and FB9, create DB9 as an instance data block of FB9 and created two DBs (shared) wih the structure shown in the attachment.

Now, blocks are downloaded into PLCSIM and switch is set to RUN, I see how DB's actual values are filling with calculated ones in the FB9 (online monitoring) at the point when DB is full and PLC goes to STOP mode. Actual DB1 values are shown in the second attached picture. So far so good.


Now the real problem is that I don't know how to export these values to a text file which can be imported to Excel.
L D[AR2 said:
]
Using plcsim, I generated the sine waves using S7 plc code, fed it into the filter FB and then logged the input/output in two DB's from which I generated source code (text). I exported the source code then imported that into a spreadsheet (openoffice) and plotted the results.

There's also one more problem, all actual values are reset to zero values whenever I switch off monitoring.

Can anybody give some advice on this one?

Thanks

DB1.jpg DB1 online.jpg
 
You would have to upload the DB's from the CPU to the off line project to have real data in your project and then create a source of the DB.

I would imagine there must be some way to convert the source to a CSV file, afraid I don't have the software to look at options.
 
Pandiani - from your online blocks folder, copy the DB's and paste them into your offline blocks folder. When you open them in the offline view, the saved values will be shown.

Whilst you have the editor open, select Options>Customize then select the Sources tab and set as screen shot below.


Each time you save a block, the source will be generated automatically. For example open the two DB's, then save them, then close the editor.

You can then export the source to a text file or open the source file using Step 7 and copy/paste the text as you require.

src009009.jpg
 
Simon, thank you.
This is basically what PeterW suggested. I used this with Upload station which resulted with another copy of everything.
Now, I have one more question, if I decide to do this in real world PLC program, which OB I need to insert in order to avoid PLC going to stop mode?
I guess, I cannot shrink or expand DB online (dynamically). I need to create DB structure in advance, right?

Thanks again.
 
little of topic. i would recommend to cut all but the program window when posting screens. now it does not seem to show anything that would be bad for ousider to see, but some other day u or someone other might forgot it there.

And little funny hearsay: (i heard someone took pictures from firefox and forgot "*** in amsterdam" in search bar..)
 
little of topic. i would recommend to cut all but the program window when posting screens. now it does not seem to show anything that would be bad for ousider to see, but some other day u or someone other might forgot it there.

Of course, just was in a hurry. I bet number of views will start to increase... :)
 
Now, I have one more question, if I decide to do this in real world PLC program, which OB I need to insert in order to avoid PLC going to stop mode?
I guess, I cannot shrink or expand DB online (dynamically). I need to create DB structure in advance, right?

Thanks again.

You should code the sampling program to start (using edge detection for example) and stop (by jumping around the program for example) when you have reached the max number of samples and not use the error OB to prevent the plc going in to stop.

You can dynamically create DB's but not change their size. I would create a DB (not dynamically) of a size to match the number of samples you require. You can test the size of the DB and use it to determine when to stop sampling. If you need more samples, make the DB bigger.
 

Similar Topics

I was given a Vijeo project file to do some work on and part of that requires that I do some fiddling with some images they have in the Resource...
Replies
0
Views
2,526
I am very familiar with Studio 5000 PLC programming. And I'm very familiar with C-More HMI programming. But this is my first time using a C-More...
Replies
2
Views
330
As the title says, I'm trying to figure out a way to import and export recipe files from an external CF card to a USB drive and vice versa. I've...
Replies
1
Views
515
Can anyone tell me how to export tags from PC Worx to a .csv file?
Replies
0
Views
331
Hello Everyone, Happy 4th of July to my neighbors! Is there a way to edit Alarms in Excel? The native export is XML, and there is always...
Replies
3
Views
838
Back
Top Bottom