OK there are two ways of doing this. the first is simpler to understand and the second is more complex but you may find ultimately that it reduces the amount of math’s in you main program.
1) Siemens analogue cards must be addressed as a peripheral address. so set the address of the 470 card, it should be somewhere between 128 and 224, on a 115U rack this is done on the IM306 card at the end of the rack.
the simplest way to write to the card would be :-
L FW 100 = This loads the data from Flag Word 100 into the accumulator
T PW 128 = This transfers the data from the accumulator to the card addressed at peripheral word 128
If the card is addressed at 128 then the channels will be
channel 1 = 128
channel 2 = 130
channel 3 = 132
channel 4 = 134
...ect
Of the two bytes used the data used to make up the value of the output is the most significant 12 bits of the 16bits.
This method is clean and easy to understand, but means that you have to do the math’s to convert the data in your program to a relevant value for the card to output. This is the method I use to test a 470 card.
2) there is a function block that can be used to write to an analogue card FB251 this is explained in chapter 10 of the 115U manual page 10-58. This allows you to create the upper and lower limits of the range of the card then tell the function block what the card is to output and it will calculate the correct output value for the card. i.e. if you say the upper limit is 100 and the lower limit is 0 for a +10v output channel, then tell it that the value is 50 the function block will calculate the correct value to output to the card in order that it outputs +5v.
the STL for this call would be
JU FB 251 = jump unconditionally to function block 251
NAME: RLG:AA
XE : FW 100 = Analogue value to be output is read from flag word 100
BG : KF +128 = address for the 470 card
KNKT : KY 0,0 = KN is the channel number on the card KY determines wither the card is unipolar or bipolar
ORG : KF +100 = the upper limit of the range is 100
URG : KF +0 = this is the lower limit of the range
FEH : F10.0 = if you ask the function block to write to a channel that isn’t there this flag will be set
BU : F10.1 = if you ask the function block to write a value that is out side your range (ORG to URG) than this flag will be set.
I hope this is of some help to you, I know this stuff backwards but its so hard to put it in writing! Let me know if you need more help. Good luck and if your new to SIEMENS then don’t let them get you down its them that are unnecessarily complex not you that can't understand.
Nick