This is an extremely good routine used to generate random numbers in a PLC for random timer routines. Often with swimming pool jobs the features are required to be timed in a random fashion. I devised a random number generator for this purpose that could be limited between certain values. For example, feature one to be random timed on and off between 10 minute on and 5 minutes off etc. My example was somewhat more simple and unsophisticated than this but worked effectively and did what I wanted it to do. It was the subject of another post here where many of our illustrious contributors determined it was impossible to generate random numbers in a PLC. I disagreed because I had done it.
This particular routine was coded by Sleepy Wombat, who obviously has too much time on his hands. Yes, it is a very impressive piece of code, and it does generate random numbers beautifully. It was developed in Omron CX-Programmer and was obviously coded for use in an Omron CJ1/CS1 PLCs. These PLCs have an awesome instruction set and are extremely powerfull. Very much my favourite PLCs at the moment. You can see from the code that the instruction set is, at the very least, extensive. I find it very difficult to go away from these beasts and have to work with a reduced instruction set in other brands. More people should become aware of these little dears and what they can do.
I might add that Sleepy Wombat is my supplier's representative for these lovely little things. He and I do collaborate quite a bit on coding, projects etc. We were both extremely frustrated over a job just recently where I was unable to read from a device using an Omron CJ1 serial port and CX-Protocol. I was trying to communicate from the CJ1 serial board to a generator controller through an Adam 4250 isolated RS232/485 converter. We are both very experienced with Omron, and other brands of, PLCs. We spent hours trying to resolve framing error issues and occassional information from the device. The device is manufactured here in Ozz and has a combined RS422/485 port that is designed to fit all variants of 422/483 Modbus RTU communications. RTU commons and all sorts of things. At the end of the day the problem turned out to be termination of the comms line, again. We had tried standard 120 ohm resistor, 120 ohm resistor and 22pf ceramic in series and parallel etc etc. Removing the resistor from the Adam 4520 solved the problem. Extremely frustrating and time consuming. It now works bl**** well.
I guess that anyone unfamiliar with Omron would have trouble interpreting *F (floating point multiply) FLTL (32 bit to floating) A351 (clock area) etc. *, /, + and - would probably be more familiar, particularly to those of us who use Windows calculator and Excel.
The instruction reference manual for these things is 1135 pages long. I think there are about 500 instructions available for use in the PLCs. Leaves you a lot of room to do a lot of fancy routines.
Congratulations to Sleepy for devising this little piece of very effective and simple code. As I said, too much time on his hands.
beerchug