ISaGRAF. Version 3.4

         

FA_WRITE


Àðãóìåíòû:

ID                         INT                 íîìåð ôàéëà: âîçâðàùåííûé ôóíêöèåé F_WOPEN

IN                         INT                 öåëàÿ àíàëîãîâàÿ âåëè÷èíà, êîòîðóþ íóæíî çàïèñàòü â ôàéëà.

Q                          BOO              ñòàòóñ âûïîëíåíèÿ: TRUE åñëè ok

Îïèñàíèå:

Çàïèñûâàåò àíàëîãîâûå ïåðåìåííûå â äâîè÷íûé ôàéë. Ýòà ôóíêöèÿ îñóùåñòâëÿåò ïîñëåäîâàòåëüíûé äîñòóï ê ôàéëó, íà÷èíàÿ ñ ïðåäûäóùåé ïîçèöèè. Ïåðâûé âûçîâ ïîñëå F_WOPEN çàïèñûâàåò ïåðâûå 4 áàéòà ôàéëà, êàæäûé âûçîâ ñäâèãàåò óêàçàòåëü ÷òåíèÿ. Äëÿ ïðîâåðêè äîñòèãíóò ëè êîíåö ôàéëà èñïîëüçóéòå F_EOF.  Ýòà ôóíêöèÿ íå âêëþ÷åíà â ñèìóëÿòîð ISaGRAF.

(*FBD ïðîãðàììà*)

(* ST Ýêâèâàëåíò: *)

file_id := F_WOPEN('voltramp.bin');

nb_written  := 0;

nb_written := nb_written + ana(FA_WRITE(file_id,vstart));

nb_written := nb_written + ana(FA_WRITE(file_id,vend));

nb_written := nb_written + ana(FA_WRITE(file_id,vinc));

nb_written := nb_written + ana(FA_WRITE(file_id,ana(delta_tim)));

ok := F_CLOSE(file_id);

IF ( nb_written <> 4) THEN

                ERROR := ERR_FILE;

END_IF;

(* IL Ýêâèâàëåíò: *)

                         LD              'voltramp.bin'

                         F_ROPEN

                         ST              file_id

                         LD              0

                         ST              nb_written

                         LD              file_id                         (* ïèñàòü vstart *)

                         FA_WRITE  vstart

                         ANA

                         ADD           nb_written

                         ST              nb_written

                         LD              file_id                         (* ïèñàòü vend *)

                         FA_WRITE  vend

                         ANA

                         ADD           nb_written

                         ST              nb_written

                         LD              file_id                         (*ïèñàòü vinc *)

                         FA_WRITE  vinc



Ñîäåðæàíèå ðàçäåëà