ScriptName "3964 - Beispiel" ScriptAuthor " ST/da " ScriptVersion "V 1.0" // example for 3964 ( not R ) SetErrorHandler ( :Address ) ; 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; var Destination : Byte ; moveconst( NullByte, 0); moveconst( NullWord, 0); moveconst( Timeout, 1); // min.Zeit = 1ms //Set ( BusInputSize, 10 ); //Set ( BusOutputSize, 10) ; Set ( Parity , even ) ; Set ( Stopbits , 1 ) ; Set ( Startbits , 1 ) ; Set ( Databits , 8 ) ; Set ( Baudrate , 9600 ) ; Init3964 ( Low , 15 ) ; // Init for 3964 (not R ) //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); moveconst (MaxEmpfFBSize, 11); moveconst (RS_SendB[0], "Hallo World"); Send3964R (RS_SendB[0], MaxEmpfFBSize ) ; Set (RS_State_LED, StaticGreen ); jump :start; :Address; Get ( ErrorCode , Destination ) ; return;