You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old April 10th, 2003, 03:00 PM   #1
NightCraver
Guest
 
Posts: n/a
Question Need ONS Random Counter

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.
  Reply With Quote
Old April 10th, 2003, 03:45 PM   #2
kamenges
Member
United States

kamenges is offline
 
kamenges's Avatar
 
Join Date: Nov 2002
Location: Brillion, WI
Posts: 2,879
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
  Reply With Quote
Old April 10th, 2003, 03:46 PM   #3
Steve Bailey
Lifetime Supporting Member + Moderator
United States

Steve Bailey is offline
 
Steve Bailey's Avatar
 
Join Date: Apr 2002
Location: The boondocks of Western Massachusetts USA
Posts: 4,664
Quote:
I had this figured out on paper but lost it.
I translated that statement to Spanish, then to French, then to German, then back to English, and the result was "The dog ate my homework". If you figured it out once, then presumably you can figure it out again.

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:
The next step I think I can get. I want to use an Analog input to find the random numbers.
I'm glad that you're sure of yourself on this one, because I'm not. Interesting concept though: an analog input as a search engine for random numbers.
  Reply With Quote
Old April 10th, 2003, 03:51 PM   #4
jdbrandt
Supporting Member
United States

jdbrandt is offline
 
jdbrandt's Avatar
 
Join Date: Oct 2002
Location: Pennsylvania
Posts: 676
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).
  Reply With Quote
Old April 10th, 2003, 04:09 PM   #5
NightCraver
Member
United States

NightCraver is offline
 
NightCraver's Avatar
 
Join Date: Apr 2003
Posts: 3
Post This is what I'm trying to remember

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.
  Reply With Quote
Old April 10th, 2003, 05:12 PM   #6
kamenges
Member
United States

kamenges is offline
 
kamenges's Avatar
 
Join Date: Nov 2002
Location: Brillion, WI
Posts: 2,879
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.
  Reply With Quote
Old April 10th, 2003, 05:42 PM   #7
NightCraver
Member
United States

NightCraver is offline
 
NightCraver's Avatar
 
Join Date: Apr 2003
Posts: 3
Post Will try to impliment soon

Still Not quit there.


Thanks everyone for your help and I try to do that stuff next post Keith.
  Reply With Quote
Old April 10th, 2003, 09:07 PM   #8
NightCraver
Member
United States

NightCraver is offline
 
NightCraver's Avatar
 
Join Date: Apr 2003
Posts: 3
Talking





__________________
NightCraver
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


All times are GMT -5. The time now is 12:57 AM.


.