![]() |
||
|
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc. |
||
| ||
New Here? Please read this important info!!!
|
|
#1 |
|
Guest
Posts: n/a
|
I am making a Safe Cracking Program for Class on a SLC500, 4 card Chassis.
I need to generate a random number using a timer that counts at .01sec Pre 10 Accum 0 Resetting continuously. Then within a CTU Pre 3, the User will then press a button grab the number from the timer with a ONS to move in into the integers N:7/0, N:7/1, & N:7/2. I had this figured out on paper but lost it. The next step I think I can get. I want to use an Analog input to find the random numbers. |
|
|
|
#2 |
|
Member
|
NightCraver-
The hard part's done. You have the concept. And it's a good one, by the way. It looks like you listed all the functions you need, too. If you have any specific questions on implementing an instruction or a rung, post them here and we'll help you out. But just go down the path you outlined in your post and you shouyld be golden. Keith |
|
|
|
#3 | ||
|
Lifetime Supporting Member + Moderator
|
Quote:
You'll need to read up on indexed addressing techniques, because that's how you'll move the timer ACC value you snagged into a different register. The counter ACC value will be your index. Quote:
|
||
|
|
|
#4 |
|
Supporting Member
|
scan timer
I've used the 'actual scan time' as a seed to a random number
generator before. Take actual scan time, add the r.t. seconds then limit it for a two digit number (1-99), then do a 'center squared' routine. Look up 'center squared' in an old FORTRAN book... or ask me (and old FORTRAN programmer). |
|
|
|
#5 |
|
Member
|
This is the Basic Code line I'm attempting to make work
I'm away from my software at the moment so please don't laugh to hard. |-----|-----|I:3/0|---|-------------------(B:3/0) |.......|-----|B:3/0|---| | |-----|B:3/0|--------|T:4/DN|---------[Ton T:4.0] |................................................. 0.01Sec |................................................. Pre 9 |................................................. Accum 0 | |-----|I:3/2|--------|ONS|------------[CTU C:5.0] |................................................. Pre 3 |................................................. Accum 0 | |----|ONS|-----------------------------(MOV) |................................................. .T:4.ACCUM |................................................. .N:7.1 I will try to use a light to insure that N:7.1 has a value assigned to it. Most likely will have to use a greater than less than Statement |----|N:7.1|--------------------------(0:4.0)
__________________
NightCraver Last edited by NightCraver; April 10th, 2003 at 04:11 PM. |
|
|
|
#6 |
|
Member
|
OK. Good start. You are pretty close but you missed a couple of the details you listed in your forst post.
You seem to go through the trouble of setting up a method to start your random number generator (B3/0). But you have no method to stop it once it starts. I suggest either leaving this out or putting in a stop mechanism. The stop conditions are up to you. The general idea on the free-running timer looks good. Just make sure your sense on the timer contact is what you want (NO versus NC). The counter increment looks good. But remember the details. This will only work once the way you are set up now. I think you forgot something at the beginning of your move rung. Oneshots on the power rail don't do much good. Also you are missing a filing concept that you stated from your original post. In your current example, where will the timer accumulated value go every time you store it? This is personal opinion but don't use the value in N7:1 to drive your light. Really consider what it is you want the operator to know and drive it that way. Do you really care that any given value is in any given location? That does the operator actually need to know? By the way, your address definitions need a bit of polish. Input and output image table references are a special case as the I and O define both a data type and a file number. This is why they are addressed as I:XX/XX. All other files have separate file type and file number designators. So you get N7:1 for an integer reference and N7:1/0 for a bit reference. Just remember: <file type><file number>:<element number>/<bit number> Keep goin'. Don't bail now. Keith Last edited by kamenges; April 10th, 2003 at 05:31 PM. |
|
|
|
#7 |
|
Member
|
Still Not quit there.
![]() ![]() Thanks everyone for your help and I try to do that stuff next post Keith. |
|
|
|
#8 |
|
Member
|
__________________
NightCraver |
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Topics
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need help with counter in Siemens S7-300 | lostpatrol | LIVE PLC Questions And Answers | 6 | April 12th, 2011 04:59 AM |
| High Speed Counter on FX0S | sara | LIVE PLC Questions And Answers | 2 | November 11th, 2004 09:15 AM |
| AB Micro High Speed Counter Trouble | Rocky Cortis | LIVE PLC Questions And Answers | 2 | September 19th, 2004 01:09 PM |
| What is the best way to send 4 signals to a counter? | Anibal Hernandez | LIVE PLC Questions And Answers | 11 | March 15th, 2004 12:09 PM |
| rpm counter | LIVE PLC Questions And Answers | 4 | July 23rd, 2003 06:52 PM | |