土木在线论坛 \ 电气工程 \ 工业自动化 \ 西门子高手解答

西门子高手解答

发布于:2009-05-10 09:52:10 来自:电气工程/工业自动化 [复制转发]
CALL #FBKey1 //FB110
wIKeyOn :="DB_PANEL".functen_key1 // evaluate keys DB110.DBW40
wIKeyOff :=
wMaskOff :=
wMaskJog :=W#16#FFFF
wBlock :="wKEYBLOCK1-16" //MW88
wFunctionFlag:="wFUNCT1-16" //MW98
wFunctionPuUp:="wPUFUNCT1-16" //MW14
wKeyFlag :="wKEY1-16" //MW78
mBlock :="M 10.0"

FB110程序如下:
接口:
IN:wIKeyOn
wIKeyOff
wMaskOff
wMaskJog
wBlock
OUT:wFunctionFlag
wFunctionPuUp
INOUT:wKeyFlag
mBlock
STAT:wEdgeOn
wEdgeOff
mAktiv
wPuUp
wPuDo
wEdgeFunction
wEdgeBlock
TEMP:wPulse
wTemp1
wPulsOnBlock
wPulsBlock

SEG1:edge generation
A #mAktiv
JC NW2
L #wBlock // edge evaluation "Block"
L #wEdgeBlock
XOW
AW
T #wPulsBlock // positive pulse "Block"
TAK
T #wEdgeBlock

L #wPulsBlock // keys that still be activ and have jogging function,
L #wIKeyOn // will switched on once more if "Block" is "1" again
AW
L #wMaskJog
AW
T #wPulsOnBlock

L #wIKeyOff // only Off - keys
INVI // "0" = OFF
L #wMaskOff // edge evaluation Off - keys
AW
L #wFunctionFlag // function = "1" ?
AW
L #wEdgeOff
XOW
AW
T #wTemp1 // pulses Off - keys
L #wIKeyOff
INVI
T #wEdgeOff

L #wFunctionFlag // evaluate only positiv edge of On-key
L #wMaskOff // if function not switched on already
AW
INVI
L #wIKeyOn // edge evaluation panel-keys / On - keys
AW
L #wEdgeOn
XOW
T #wPulse
AW
L #wPulsOnBlock // pulses ON if jogging keys und "Block" ok.
OW
T #wPuUp // positive pulses

L #wEdgeOn
L #wPulse
AW
L #wMaskOff // no pulses by separat off keys
INVI // of on keys
AW
L #wTemp1 // negative pulses of Off - keys
OW
T #wPuDo // negative pulses

L #wPulse // pulse "one key has changed the value"
L #wTemp1
OW
L #wPulsOnBlock
OW
T #wPulse

L #wPulse
L 0
==I
JC Ausw // jump to evaluation of "function"
L #wIKeyOn
T #wEdgeOn
L #wIKeyOff
T #wEdgeOff
SEG2:pulse evaluation
L 0
T #wFunctionPuUp // reset pulse output
L #wMaskJog // mask keys with On/Off function
L #wMaskOff
OW
INVI
L #wPuUp
AW
L #wKeyFlag
XOW
T #wKeyFlag // keys with On/Off function

L #wIKeyOff // Off key must not be actuated
INVI
L #wMaskOff // mask Off keys
AW
INVI
L #wMaskOff
AW
L #wMaskJog // mask keys with jogging function
OW
L #wPuUp
AW
L #wKeyFlag // set with PuUp
OW
T #wKeyFlag

L #wMaskJog // mask keys with jogging function
L #wMaskOff // mask Off keys
OW
L #wPuDo
AW
INVI
L #wKeyFlag
AW // reset with PuDo
T #wKeyFlag
SET
S #mAktiv // evaluation in next cycle
BEU

NW2: L #wFunctionFlag // save function
T #wTemp1

Ausw: L #wKeyFlag
L #wBlock // connect with flag "Block"
AW
T #wFunctionFlag // store function
T #wKeyFlag
L #wEdgeFunction // positive edge evaluation
XOW // of the function
AW
T #wFunctionPuUp // pulse output
TAK
T #wEdgeFunction // set edge flags

AN #mAktiv // evaluation "switching condition not fulfilled"
BEC
SET
R #mAktiv
L #wTemp1 // check function whether has changed
XOW
INVI
T #wTemp1
L #wPuUp // compare with positve pulses
AW
JP m1
L #wMaskJog // remove the negative pulse of the On keys
L #wMaskOff
OW
L #wPuDo
AW
L #wTemp1 // compare with negative pulses
AW
JP m1
BE
SET
m1: S #mBlock // function is blocked




这就是FB110的调用全过程,希望哪个高人帮我解答哈,先XOW再AW,是为了产生脉冲吗?静态变量的使用不是很清楚,感觉很难读懂,谢谢

全部回复(9 )

只看楼主 我来说两句
  • cywan2008
    cywan2008 沙发
    这些临时变量的定义,静态变量的定义呢?还有调用呢?
    2009-05-19 20:48:19

    回复 举报
    赞同0
  • libofan
    libofan 板凳
    楼主帮我解释下,谢谢!
    SET
    SAVE
    = L 50.1
    A #COM_RST
    JCN A7d0
    L #LMNRSVAL
    T #LMNR_SIM
    CLR
    = #QLMNUP
    = #QLMNDN
    L 0.000000e+000
    T #PV
    T #ER
    = #LMNRS_ON
    T #LMNRSVAL
    T #LMNR_SIM
    T #sFbPVal
    T #sThrOn
    L 0
    T #siImpAus
    L T#0MS
    T #stImpDauer
    T #stPausDauer
    JU A7d1
    A7d0: L #PV_PER
    ITD
    DTR
    L 3.616898e-003
    *R
    T #Istwert
    L #PV_FAC
    *R
    L #PV_OFF
    +R
    T #Istwert
    CLR
    A #PVPER_ON
    NOT
    JCN A7d2
    L #PV_IN
    T #Istwert
    A7d2: L #Istwert
    T #PV
    L #SP_INT
    TAK
    -R
    T #ErKp
    L #DEADB_W
    NEGR
    JCN A7d3
    TAK
    L #DEADB_W
    +R
    T #ER
    JU A7d4
    A7d3: L #ErKp
    L #DEADB_W
    >R
    JCN A7d5
    -R
    T #ER
    JU A7d4
    A7d5: L 0.000000e+000
    T #ER
    A7d4: L #ER
    L #GAIN
    *R
    T #ErKp
    L #CYCLE
    DTR
    L 1.000000e+003
    /R
    T #rCycle
    L #TI
    DTR
    L 1.000000e+003
    /R
    T #rTi
    L #rCycle
    L 5.000000e-001
    *R
    L #rTi
    TAK
    JCN A7d7
    L #rCycle
    L 5.000000e-001
    *R
    T #rTi
    A7d7: L #MTR_TM
    DTR
    L 1.000000e+003
    /R
    T #rMtrTm
    L 1.000000e-002
    L #ErKp
    *R
    L #rMtrTm
    *R
    ABS
    L #rTi
    TAK
    -R
    T #Hvar
    L 1.000000e-001
    L #rTi
    *R
    L #Hvar
    TAK
    JCN A7d8
    L 1.000000e-001
    L #rTi
    *R
    T #rTi
    JU A7d9
    A7d8: L #Hvar
    T #rTi
    A7d9: CLR
    A #LMNS_ON
    JCN A7da
    L 0.000000e+000
    T #sFbPVal
    JU A7db
    A7da: L #siImpAus
    L 0
    <>I
    JCN A7dc
    TAK
    ITD
    DTR
    L #rCycle
    *R
    L #rMtrTm
    /R
    T #dInteg
    JU A7dd
    A7dc: L #ErKp
    L 0.000000e+000
    >R
    A #LMNR_HS
    = L 50.2
    A #LMNR_LS
    O L 50.2
    L #TI
    L T#0MS
    = L 50.2
    ==D
    O L 50.2
    JCN A7de
    L 0.000000e+000
    T #dInteg
    JU A7dd
    A7de: L #ErKp
    NEGR
    L #rCycle
    *R
    L #rTi
    /R
    T #dInteg
    A7dd: L #sFbPVal
    L #dInteg
    +R
    T #sFbPVal
    L #TI
    L T#0MS
    ==D
    JCN A7db
    L #sFbPVal
    L 1.000000e+002
    >R
    JCN A7e1
    T #sFbPVal
    JU A7db
    A7e1: L #sFbPVal
    L 0.000000e+000
    JCN A7db
    T #sFbPVal
    A7db: L #ErKp
    L #sFbPVal
    -R
    L #DISV
    +R
    T #dThrStIn
    L #ErKp
    T #AdapIn1
    L #sFbPVal
    T #AdapIn2
    L 5.500000e+001
    L #rMtrTm
    /R
    L #rCycle
    *R
    T #rThrOff
    L #PULSE_TM
    L #CYCLE
    >D
    JCN A7e4
    TAK
    DTR
    L 1.000000e+003
    /R
    T #Hvar
    JU A7e5
    A7e4: L #rCycle
    T #Hvar
    A7e5: L 1.000000e+002
    L #Hvar
    *R
    L #rMtrTm
    /R
    T #Hvar
    CLR
    A #LMNR_HS
    O #LMNR_LS
    NOT
    JCN A7e6
    A #QLMNUP
    O #QLMNDN
    NOT
    JCN A7f0
    L #TI
    L T#0MS
    <>D
    JCN A7e8
    L #AdapIn1
    ABS
    T #AdapIn1
    L #AdapIn2
    ABS
    T #AdapIn2
    JCN A7e9
    TAK
    T #sThrOn
    JU A7eb
    A7e9: L #AdapIn2
    T #sThrOn
    JU A7eb
    A7e8: L #Istwert
    L 0.000000e+000
    ==R
    JCN A7ec
    L #Hvar
    T #sThrOn
    JU A7eb
    A7ec: L #ErKp
    ABS
    L 5.000000e-001
    *R
    T #sThrOn
    A7eb: L #sThrOn
    L 1.000000e+001
    >R
    JCN A7ee
    T #sThrOn
    A7ee: L #sThrOn
    L #Hvar
    JCN A7ef
    T #sThrOn
    A7ef: JU A7f0
    A7e6: L #Hvar
    T #sThrOn
    A7f0: L #siImpAus
    L 100
    ==I
    L #dThrStIn
    L #rThrOff
    = L 50.2
    >R
    A L 50.2
    TAK
    L #sThrOn
    = L 50.2
    >=R
    O L 50.2
    JCN A7f1
    L 100
    T #iImpEin
    JU A7f2
    A7f1: L #siImpAus
    L -100
    ==I
    L #rThrOff
    NEGR
    L #dThrStIn
    TAK
    = L 50.2
    A L 50.2
    L #sThrOn
    NEGR
    L #dThrStIn
    TAK
    = L 50.2
    <=R
    O L 50.2
    JCN A7f3
    L -100
    T #iImpEin
    JU A7f2
    A7f3: L 0
    T #iImpEin
    A7f2: CLR
    A #LMNS_ON
    JCN A7f5
    A #LMNUP
    X #LMNDN
    JCN A7f6
    A #LMNUP
    JCN A7f7
    L 100
    T #iImpEin
    JU A7f5
    A7f7: L -100
    T #iImpEin
    JU A7f5
    A7f6: L 0
    T #iImpEin
    A7f5: L #iImpEin
    L 100
    ==I
    A #LMNR_HS
    TAK
    L -100
    = L 50.2
    ==I
    A #LMNR_LS
    O L 50.2
    JCN A7fa
    L 0
    T #iImpEin
    A7fa: L #siImpAus
    L -100
    ==I
    L #iImpEin
    L 100
    = L 50.2
    ==I
    A L 50.2
    L #siImpAus
    TAK
    = L 50.2
    ==I
    L #iImpEin
    L -100
    = L 50.3
    ==I
    A L 50.3
    O L 50.2
    JCN A7fb
    L 0
    T #iImpEin
    A7fb: L #siImpAus
    L #iImpEin
    <>I
    JCN A7fc
    L 0
    ==I
    JCN A7fd
    L #stImpDauer
    L T#0MS
    <=D
    JCN A7fc
    L 0
    T #siImpAus
    L #BREAK_TM
    T #stPausDauer
    JU A7fc
    A7fd: L #stPausDauer
    L T#0MS
    <=D
    JCN A7fc
    L #iImpEin
    T #siImpAus
    L #PULSE_TM
    T #stImpDauer
    A7fc: L #stImpDauer
    L T#0MS
    >D
    JCN A801
    TAK
    L #CYCLE
    -D
    T #stImpDauer
    JU A802
    A801: L T#0MS
    T #stImpDauer
    A802: L #stPausDauer
    L T#0MS
    >D
    JCN A803
    TAK
    L #CYCLE
    -D
    T #stPausDauer
    JU A804
    A803: L T#0MS
    T #stPausDauer
    A804: L #siImpAus
    L 100
    ==I
    A #LMNR_HS
    TAK
    L -100
    = L 50.2
    ==I
    A #LMNR_LS
    O L 50.2
    JCN A805
    L 0
    T #siImpAus
    L T#0MS
    T #stImpDauer
    A805: CLR
    A #LMNRS_ON
    NOT
    JCN A806
    L #LMNRSVAL
    T #LmnrSim
    JU A807
    A806: L #siImpAus
    ITD
    DTR
    L #rCycle
    *R
    L #rMtrTm
    /R
    L #LMNR_SIM
    +R
    T #LmnrSim
    L 1.000000e+002
    >=R
    JCN A808
    T #LmnrSim
    JU A807
    A808: L #LmnrSim
    L 0.000000e+000
    <=R
    JCN A807
    T #LmnrSim
    A807: L #LmnrSim
    T #LMNR_SIM
    L #siImpAus
    L 0
    ==I
    JCN A80b
    CLR
    = #QLMNUP
    = #QLMNDN
    JU A7d1
    A80b: L #siImpAus
    L 100
    ==I
    JCN A80d
    SET
    = #QLMNUP
    CLR
    = #QLMNDN
    JU A7d1
    A80d: CLR
    = #QLMNUP
    SET
    = #QLMNDN
    A7d1: CLR
    A L 50.1
    SAVE
    BE
    2009-05-19 11:17:19

    回复 举报
    赞同0
加载更多
这个家伙什么也没有留下。。。

工业自动化

返回版块

17.92 万条内容 · 369 人订阅

猜你喜欢

阅读下一篇

求西门子300的cpu面板指示灯的详解

有谁能发一些关于西门子300的cpu面板指示灯的详解和发生错误时的解决方法!谢谢了。。。。。。

回帖成功

经验值 +10