25.07.2014 Views

1756-PM003H-EN-E, SFC and ST Programming Languages ...

1756-PM003H-EN-E, SFC and ST Programming Languages ...

1756-PM003H-EN-E, SFC and ST Programming Languages ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

6-28 Program Structured Text<br />

Comments<br />

To make your structured text easier to interpret, add comments to it.<br />

• Comments let you use plain language to describe how your structured<br />

text works.<br />

• Comments do not affect the execution of the structured text.<br />

Structured text comments are downloaded into controller memory <strong>and</strong> are<br />

available for upload. To add comments to your structured text:<br />

To add a comment:<br />

on a single line<br />

at the end of a line of structured<br />

text<br />

within a line of structured text<br />

Use one of these formats:<br />

//comment<br />

(*comment*)<br />

/*comment*/<br />

(*comment*)<br />

/*comment*/<br />

that spans more than one line<br />

(*start of comment . . . end of<br />

comment*)<br />

/*start of comment . . . end of<br />

comment*/<br />

For example:<br />

Format:<br />

//comment<br />

Example:<br />

At the beginning of a line<br />

//Check conveyor belt direction<br />

IF conveyor_direction TH<strong>EN</strong>...<br />

At the end of a line<br />

ELSE //If conveyor isn’t moving, set alarm light<br />

light := 1;<br />

<strong>EN</strong>D_IF;<br />

(*comment*)<br />

Sugar.Inlet[:=]1;(*open the inlet*)<br />

IF Sugar.Low (*low level LS*)& Sugar.High (*high level<br />

LS*)TH<strong>EN</strong>...<br />

(*Controls the speed of the recirculation pump. The<br />

speed depends on the temperature in the tank.*)<br />

IF tank.temp > 200 TH<strong>EN</strong>...<br />

/*comment*/<br />

Sugar.Inlet:=0;/*close the inlet*/<br />

IF bar_code=65 /*A*/ TH<strong>EN</strong>...<br />

/*Gets the number of elements in the Inventory array<br />

<strong>and</strong> stores the value in the Inventory_Items tag*/<br />

SIZE(Inventory,0,Inventory_Items);<br />

Publication <strong>1756</strong>-<strong>PM003H</strong>-<strong>EN</strong>-E (excerpt from <strong>1756</strong>-PM001H-<strong>EN</strong>-P) - August 2005

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!