ScriptName "example for DN and EDS" ScriptAuthor "GS" ScriptVersion "V 1.0" //======================================================== // Constants //======================================================== Var LenBusDataIn : Byte; MoveConst(LenBusDataIn, 8 ); Var LenBusDataOut : Byte; MoveConst(LenBusDataOut, 8 ); //======================================================== // Variables //======================================================== Var MyErrorCode : Byte; :SetupDeviceNet; Set(VendorID, 272); // VendCode = 272; Set(DeviceType, 12); // ProdType = 12; Set(DeviceRevision, 0x021E); // 02 = MajRev=2, 1E=MinRev=30 Set(ProductCode, 0x1234); // 0x1234 => 4660 decimal SetByVar(BusInputSize, LenBusDataIn); // 3, $ consumed size SetByVar(BusOutputSize, LenBusDataOut); // 5, $ produced size Set ( BusBaudrate , 125000 ) ; Set ( fieldbusID , 1 ) ; //======================================================== :StartTheBus; //======================================================== // SetSystemErrorHandler(:ErrorHandler); BusStart; Wait(Bus_Active); //======================================================== :MainLoop; //======================================================== // Get(BusDataChanged, NewBusData); // If NewBusData Equal True Then :CheckNewBusData1 Else :CheckNewRSData; :CheckNewBusData1; //... jump :MainLoop; //======================================================== :CheckNewRSData; //======================================================== //... //======================================================== :ErrorHandler; //======================================================== Get(ErrorCode, MyErrorCode); Return;