Jump to content
Sign in to follow this  
Elfstone

Accessing SD Block by PC

Recommended Posts

Hello, and happy new year to unitronics community !

Our enterprise creates acquisition softwares and we have decided to standardize our application with unitronics Modules. Therefore, I have to interface a V350 with our SCADA.

Is It possible to access files stored on the SD card (by function block "Write Data Table To SD") directly by PC (are there dll already developped).

I know that there is a dll (Unitronics.DataTable) for the access to DataTable. But I was told that I have to transfer temporarely data from SD to DataTable to be able to read them from PC (by .net)

Thanks for your answer

Kind regards

I appologize for my bad english..

Sébastien

Share this post


Link to post
Share on other sites

Please ignore whatever someone told you about reading files from SD.

It is possible to read files from the SD using the .Net communication driver fairly easy.

The PLC class that you probably familiar with, has a sub-class named SD.

Inside it you will see some functions for reading, writing and Listing the content of the SD.

Also see my Blog Entry So... you wanna build your own SD Card Explorer?!:

http://forum.unitronics.com/index.php?/blog/3/entry-20-so-you-wanna-build-your-own-sd-card-explorer/

Reading the file from the SD should be easy. What you are going to do with it may be harder.

If the file is a UDT or FDT file, then you can use the Unitronics.DataTables.DLL in order to open the file.

Please use the most recent version of the DLL combined with the most recent .Net communication driver that can be found inside the SD Card Suite!!!

If you need to read and understant UTR, ULG and Alarms files, then you will not have an easy way of doing it.

Share this post


Link to post
Share on other sites

Hello,

Thanks a lot for your quick answer.

I only need to Read files (UDT format) and extract numeric values contained in, in order to write it on the PC with an other format, and after that delete files from the SD card.

UniComDriver combined with DataTable dll should actualy be good for my need.

However I note that when I launch your example, the "Three" of the SD card Folders automaticly appears on the Windows Explorer. Is that mandatory ? Because, as we work essentialy for pharmceutical laboratory, security is the most important thing to consider.

And consequently, I can't let user accessing the SD card directly from the windows explorer... I would prefer hide it.

I'll test this by building my project.

Have a good day

Sébastien

Share this post


Link to post
Share on other sites

I'm sorry, I realized that the folders in my windows explorer don't appear due to your example. It is because I used several SD cards and one was still connected to my computer.

Share this post


Link to post
Share on other sites
Hi, first sorry about the English (I am Brazilian). I am using the Unitronics.ComDriver library (plc [0] .SD.ReadFile) to read data from tables in a SD card inserted into a Unitronics PLC, however this function returns me a byte array and I can not identify from byte which begins the first element of the table.

I have also used the Unitronics.SD.Files library to read the udt files saved with the functions described above, but just need to save the udt files on my hard disk and then read in the form of .NET tables.

Can I read directly from the PLC tables for a .NET table?

Share this post


Link to post
Share on other sites

If you want to read directly from the PLC tables, then don't use the SD class (Since the tables are not stored in the SD, but rather in RAM).

There is a DLL called Unitronics.DataTables.dll which can be used (it requires a reference to the .Net communication driver) to read/wsrite data directly from the table.

Share this post


Link to post
Share on other sites

Thank Saragani , but I think I could not explain myself right . I can already read the PLC table , what I want is to read the tables recorded on the SD card, but the plc.SD.ReadFile function returns an array of bytes and can not find from which byte starts the first element of the table . Can you help me?

Thank Saragani , but I think I could not explain myself right . I can already read the PLC table , what I want is to read the tables recorded on the SD card, but the plc.SD.ReadFile function returns an array of bytes and can not find from which byte starts the first element of the table . Can you help me?

Share this post


Link to post
Share on other sites

And for that you can use the Data Tables DLLs, and also the SD Files dll as well.

As far as I remember, it does not convert the data into a .Net data table. but you can do it yourself (by getting the columns from the UDT table, and then iterating the rows).

 

The structure if the udt file is complex. The data itself starts from the second chunk. Each chunk is 512 bytes, there 4 bytes (I think the last 4 bytes per chunk) are some kind of checksum, but you might also get some other header chunks in the file (since the file is appended), and you also need to now the size and structure of a single row (Which make it hard to accomplish without using the given dlls)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...