Oath Posted August 16, 2022 Report Share Posted August 16, 2022 I'm in the process of learning PLC programming, specifically in using the .NET Communications Driver to collect live-data from Vision PLCs (among other various tasks), and was wanting a way to generate some random data on the PLC for dynamic testing. What I found was a lack of a built-in random functions! So, for both the fun and functionality, I decided to implement a Shift-Register Generator for producing 32-bit Double-Word Pseudo-Random numbers (what a mouthful) based on the xorwow generator ( https://en.wikipedia.org/wiki/Xorshift#:~:text=four%20words%20*/%0Auint32_t-,xorwow,-(struct%20xorwow_state ). The project is implemented on a V570 (as it was what we had easily at-hand), but the underlying ladder logic should be easily portable to any similar hardware, so long as there are 10 DW's available for storage and output. An example of collecting just an integer value from the double word is also included. As I am still learning, please don't hesitate to point out suggestions or corrections within the program itself, in either style or implementation. Thanks! RandGen.vlp 1 Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.