Random function in STEP 7

Rating (1)

Thanks 2

8 Entries

Can any one tell me how to use a random funtion in STEP 7.Actually in my application i have to turn on 06 valves randomely.Is there any way to generated any random number from 0--->6.Please help me in this regard.waiting for your positive responses.

Hi all,This problem deals with what I need exactly right now. I need to turn some random values like reading some values fromthe transmitters. I will use this for the simulation in WinCC. But I need some codes for STL.Edit: I can call SFC64 for TIME_TCK and load it to a merker but I couldnt find the following number converting steps. TimetoDINT?

Last edited by: trigger at: 7/3/2008 9:18 AM

I found out the following note in Simatic Help:Note:A TIME data type is stored as a signed integer number of milliseconds in 2's complement format.So I think I dont need to convert TIME to DINT since it is alread signed INT? I will try the other steps and write down the result here later.

Hi again,I used the following code in OB1 and that worked. The main principle here is the MOD part. I didnt think it before. I canuse it in any place andin any combination to generate thenumbers I want.Thank you very much for the code...

Hi all,You can also use WinCC tag simulator (from tools). It is very useful.You can generate random numbers easily by defining low and high limits. What you have to do is just to link the tag generated in WinCC to tag simulator.