ScriptName "3964R - Beispiel" ScriptAuthor " ST/da " ScriptVersion "V 1.0" // example for 3964R Var RS_SendB : BUFFER [15]; Var RS_EmpfB : BUFFER [15]; var SendSize: Word; Var EmpfSize : WORD ; Var MaxEmpfFBSize : Word; Var Timeout: Word; Var NullWord : Word; Var NullByte : Byte; Var BusChanged: Byte; moveconst( NullByte, 0); moveconst( NullWord, 0); moveconst( Timeout, 1); // min.Zeit = 1ms Set ( BusInputSize, 10 ); Set ( BusOutputSize, 10) ; Set ( Parity , none ) ; Set ( Stopbits , 1 ) ; Set ( Startbits , 1 ) ; Set ( Databits , 8 ) ; Set ( Baudrate , 9600 ) ; Init3964R ( High , 15 ) ; // Init for 3964R BusStart ; Wait ( Bus_Active ) ; Set (RS_State_LED, RedGreenFlashing ); Get ( BusInputSize , MaxEmpfFBSize ) ; :start ; Receive3964R (RS_EmpfB[0], EmpfSize, Timeout) ; if EmpfSize notequal NullWord then :write_bus else :read_bus ; :write_bus; WriteBus (RS_EmpfB[0], EmpfSize ) ; Set (RS_State_LED, StaticGreen ); :read_bus ; Get ( BusDataChanged , BusChanged ) ; if BusChanged notequal NullByte then :write_rs else :start; :write_rs; ReadBus (RS_SendB[0], MaxEmpfFBSize); Send3964R (RS_SendB[0], MaxEmpfFBSize ) ; Set (RS_State_LED, StaticGreen ); jump :start;