我們的品牌

Impact-Company-Logo-English Black-01-177x54

歡迎造訪施耐德電機全球網站

歡迎訪問我們的網站
		
我们今天能为您提供什么帮助?
How to extend the life of a File System SD Card used for Logging Data
Goals and Symptoms
How to extend the life of a File System SD Card used for Logging Data

Facts and Change
Unity,

Causes and Fixes
The MODICON M340 and M580 SD Card Interface Buffer is 512 Bytes.
The optional SD File Storage Cards have 512 Byte Sectors.
The SD Card Interface includes Wear Leveling Algorithms.

SD Cards have a limited number of Write Operations per Sector before the Sector is marked bad (approximately 100,000).
Delete Operations also count against the number of Write Operations.
There is no 'Gas Gauge' to know when a Sector is approaching its end of life.

Because of these technology restrictions it is critical to optimize the use of the MODICON M340 and M580 SD File Storage Card.
This is accomplished by only writing 512 Bytes per Write Operation.

There are two exceptions to this:
> The total number of Bytes required in a file is less than 512 Bytes.
> The last Write to a file before closing it will be less than 512 Bytes.


M340/M580 SD File Storage Card Best Practices
1)Instances of the File Management EFBs in Unity Pro should be executed every scan.
This insures that the Done, Status and Error output data from them EFBs is always updated.
2)File names on the SD File Storage Card must be unique.
3)Files should be opened and remain open for as long as there will be data written.
Avoid Opening and Closing Files each time Writing is required.
4)Avoid FTP Client interaction with the Log Files that are currently Open.
5)The use of Periodic Scan Configuration of the MAST Task will reduce (improve) SD File Storage Card FTP file transfer time.


Below is Example Code. This code is only provided as a reference and is incomplete to actually
function as there is no File Create/Open nor Close.

The purpose of the Example Code is to demonstrate a method of limiting the Writing of data to the
SD File Storage Card with 512 Bytes when the overall amount of data needing to be written is
greater than 512 Bytes.

If you require a Functional Example or Application Assistance with MODICON M340 and M580 SD
File Storage Card Writing then contact your local Schneider Electric Representative or Schneider
Electric Technical Support.

Here are the Variables defined and used in the Example Code.

EXAMPLE CODE

IF %S13 THEN (* First Scan Initialization *)
MyDINT := 0;
My1025byteVariable := '';
END_IF;
IF WR_DATA_TO_FILE_EFB.DONE THEN
RESET(MyWriteToFile);
My512byteVariable := '';
JMP Skip_1_Scan;
END_IF;
IF NOT %S13 OR (WR_DATA_TO_FILE_EFB.DONE AND NOT MyWriteToFile_TargetReached) THEN
WHILE LEN_INT(IN := My1025byteVariable) <= 512 DO
MyDINTasSTRING := DINT_TO_STRING(IN := MyDINT); (* MyDINTasSTRING length = 11 characters *)
My1025byteVariable := CONCAT_STR(IN1 := My1025byteVariable,
IN2 := MyDINTasSTRING);
MyDINT := MyDINT + 1;
END_WHILE; (* here: the length of My1025byteVariable will always be 512..522 *)
My512byteVariable := My1025byteVariable; (* truncation will not set %S15 *)
MyTempINT := LEN_INT(My1025byteVariable);
My1025byteVariable := MID_INT(My1025byteVariable, MyTempINT - 512, 513);
END_IF;
Skip_1_Scan:
IF NOT MyWriteToFile_TargetReached THEN
SET(MyWriteToFile);
END_IF;
WR_DATA_TO_FILE_EFB(REQ := MyWriteToFile,
FILEDESC := MyFileDesc,
VARIABLE := My512byteVariable,
DONE => MyWriteToFile_DONE,
ERROR => MyWriteToFile_ERROR,
STATUS => MyWriteToFile_STATUS);
MyWriteTest_CTU(CU := MyWriteToFile,
R := %S13,
PV := MyWriteToFile_Target,
Q => MyWriteToFile_TargetReached,
CV => MyWriteToFile_Count);

施耐德電機Taiwan

探索更多
系列:
探索更多
系列:

需要協助?

  • 產品選型工具

    快速輕鬆地為您的應用找到合適的產品和附件。

  • 取得報價

    立即線上提交您的銷售需求,專業團隊將主動聯繫您。

  • 購買地點

    輕鬆在您所在地區找到最近的施耐德電機經銷商。

  • 支援中心

    在同一位置找到滿足您所有需求的支援資源。

  • 產品文檔
  • 軟體下載
  • 產品選型工具
  • 產品替代和替換
  • 幫助和聯絡中心
  • 尋找我們的辦公室
  • 取得報價
  • 人才招募
  • 公司簡介
  • 舉報不當行為
  • 無障礙
  • 新聞中心
  • 投資者
  • 專業洞察
  • 台灣施耐德電機學院
  • 綠色影響力落差調查
  • Schneider Go Green 2025
  • 隱私政策
  • Cookie通告
  • 使用條款
  • Change your cookie settings