AutomationDirect Customer Forum  

Welcome to the AutomationDirect Customer Forums.
These forums are intended as a place for AutomationDirect customers to help one another, share information, and share ideas.
The forums are not routinely monitored by AutomationDirect Technical Support staff. While staff members may answer questions occasionally, for a prompt response to a problem please contact Technical Support directly at: 1(800) 633-0405 or (770) 844-4200 or e-mail Tech Support.


Go Back   AutomationDirect Customer Forum > Examples and Programs

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 11-03-2009, 06:56 PM
shawn k shawn k is offline
Registered User
 
Join Date: Nov 2009
Posts: 1
Help with this program

1. Program a single timer (TMR) such that:
a. when switch 1 is on, there is a 1 sec delay, then LED 6 turns ON
b. when switch 2 is on, there is a 3 sec delay, then LED 6 turns ON
c. when switch 3 is on, there is a 5 sec delay, then LED 6 turns ON
2. Program two Shift Registers(SR) and one timer(TMR) enabled by switch 4
a. The 1st SR will turn the lights ON with the following timing (REMEMBER YOU CAN ONLY USE 1 TMR for part 2):
i. LED 1, immediately
ii. LED 2, after 2 sec.
iii. LED 3, after 4 sec.
iv. LED 4, after 3 sec.
b. Pause for 4 seconds, then turn the lights off using the second SR in reverse order (4, 3, 2, 1) with a 4 sec pause between the lights turning off, pause one second and go forward again. (REMEMBER YOU CAN ONLY USE 1 TMR FOR BOTH SR’s in part 2)
c. The process should work indefinitely.
Reply With Quote
  #2  
Old 11-03-2009, 08:36 PM
milldrone milldrone is offline
Registered User
 
Join Date: Jan 2005
Location: Anderson Ca.
Posts: 552
shawn,

A couple of questions

Quote:
Originally Posted by shawn k View Post
1. Program a single timer (TMR) such that:
a. when switch 1 is on, there is a 1 sec delay, then LED 6 turns ON
b. when switch 2 is on, there is a 3 sec delay, then LED 6 turns ON
c. when switch 3 is on, there is a 5 sec delay, then LED 6 turns ON
What do you want to happen if more than one switch is on?


Concerning the shift register part of the program Do you have to use two shift registers? Can you use just one? Do you have to use a timer at all?

When you were just a little tyke. Did the neighbor girl next door ever take you behind the woodshed and tell you "Ill show you mine if you show me yours first"?

Quote:
Originally Posted by shawn k View Post
2. Program two Shift Registers(SR) and one timer(TMR) enabled by switch 4
a. The 1st SR will turn the lights ON with the following timing (REMEMBER YOU CAN ONLY USE 1 TMR for part 2):
i. LED 1, immediately
ii. LED 2, after 2 sec.
iii. LED 3, after 4 sec.
iv. LED 4, after 3 sec.
b. Pause for 4 seconds, then turn the lights off using the second SR in reverse order (4, 3, 2, 1) with a 4 sec pause between the lights turning off, pause one second and go forward again. (REMEMBER YOU CAN ONLY USE 1 TMR FOR BOTH SR’s in part 2)
c. The process should work indefinitely.
Seriously, show us what you have.
__________________
Vaughn
Reply With Quote
  #3  
Old 11-04-2009, 07:48 AM
milldrone milldrone is offline
Registered User
 
Join Date: Jan 2005
Location: Anderson Ca.
Posts: 552
Quote:
Originally Posted by shawn k View Post
b. Pause for 4 seconds, then turn the lights off
I'm with you, up to this point

Quote:
Originally Posted by shawn k View Post
with a 4 sec pause between the lights turning off, pause one second and go forward again.
I cannot figure out what you mean by this statement. Why not just say a 5 second pause?

Here is a 64 dollar question. Is there a particular reason you need to use a shift register? A drum would be very simple to implement.
__________________
Vaughn
Reply With Quote
  #4  
Old 11-04-2009, 08:37 AM
milldrone milldrone is offline
Registered User
 
Join Date: Jan 2005
Location: Anderson Ca.
Posts: 552
Quote:
Originally Posted by milldrone View Post
A drum would be very simple to implement.
See attachment.
Attached Images
File Type: jpg drum.jpg (164.5 KB, 34 views)
__________________
Vaughn
Reply With Quote
  #5  
Old 11-05-2009, 04:00 AM
Tinker Tinker is offline
Registered User
 
Join Date: Sep 2009
Posts: 8
Quote:
Originally Posted by milldrone View Post
I'm with you, up to this point

I cannot figure out what you mean by this statement. Why not just say a 5 second pause?
I think he means that there is a 4 second delay between led2 turning off and led1 tunrning off then a 1 second delay before section a. repeats, wehere led1 will turn back on:

4 sec pause between the lights turning off, pause one second and go forward again
(forward again) a. The 1st SR will turn the lights ON with the following timing (REMEMBER YOU CAN ONLY USE 1 TMR for part 2):
i. LED 1, immediately


Quote:
Originally Posted by milldrone View Post
Here is a 64 dollar question. Is there a particular reason you need to use a shift register? A drum would be very simple to implement.
I suspect that the shift register is his homework asignement, maybe next week he'll want a drum


""I'll show you mine if you show me yours first"

I used to answer questions on Yahhoo answers, and it was not all that unusual to see a homework question where someone said they had already worked out the problem themselves but they wanted to see someone elses answer for confirmation, while I usualy ingnored such questions, once in a while I'd sugest they post their answer and then I'd tell them if they got it right, but all that ever got me was a "thumbs down" and nobody ever botherd to show their answer. The funny thing is i decided to Google "1. Program a single timer (TMR) such that:" and guess what was the second item in the search results: http://answers.yahoo.com/question/index?qid=20091103142944AA1vseC"

Unfoutunatly I not familaiar with Directsoft (and on the Yahoo post he said DL06), I don't even know if there is any standard for for a PLC "psudo code". Still, here is one Idea I had for the first part:

Quote:
1. Program a single timer (TMR) such that:
a. when switch 1 is on, there is a 1 sec delay, then LED 6 turns ON
b. when switch 2 is on, there is a 3 sec delay, then LED 6 turns ON
c. when switch 3 is on, there is a 5 sec delay, then LED 6 turns ON
if S1 or S2 or S3 -> enable timer1, interval seconds, set point 5
(if your timers count in say intervals of 100ms multiply my constants by 10, if 10ms, then * 100)
if S1 and timer1 current value = 1 -> set LED6
if S2 and timer1 current vlaue = 3 -> set LED6
if S3 and timer1 -> set LED6 (actualy the S3 is redundant here, if the timer is running and the LED is not on by now, S3 must be on)
if (not S1) and (not S2) and (not S3) -> reset LED6 (and timer1 if turning off it's enabling inputs doesn't reset it, i.e. a maintained timer)

In this case if more than one switch is closed the LED will turn on at the shortest interval selected. There is one interesting "feature" if S3 is turned on, then after more than 1 and less than 5 seconds S1 is turned on and S3 turned off (in that order) the LED will not come on even though a switch is on !, using "equals or greater than" or eliminating the "redundant" S3 in the the next to last rung would eliminate that, but that wouldn't be as much fun.

Since the details coding a shift register could be implementation dependant I'm not going to try to tackle that one in any detail, but it seems to me that one would have to program the one allowed timer as a 1 second pulse generator that clocks the SR and get the other time intervals by where you get the data out of the SR.
It seems to me too that it would be simpler to use one shift register (or a drum), but again, I think this is home work not real life.
Reply With Quote
  #6  
Old 11-05-2009, 08:00 AM
milldrone milldrone is offline
Registered User
 
Join Date: Jan 2005
Location: Anderson Ca.
Posts: 552
Quote:
Originally Posted by Tinker View Post
""I'll show you mine if you show me yours first"
I was just trying to add some humor instead of of ranting about homework.

Quote:
Originally Posted by Tinker View Post
I suspect that the shift register is his homework asignement, maybe next week he'll want a drum
I suspected this from the beginning. Thats why I responded with an answer that was usable in the industrial world, but not for his homework. I had also considered giving him the monics for the code I wrote, and stripping out everything but the rung comments.

If he were to respond I will try to lead him in the right direction. But I will not give him the answer outright.
__________________
Vaughn
Reply With Quote
  #7  
Old 11-11-2009, 04:27 PM
Tubecut Tubecut is offline
Registered User
 
Join Date: Jun 2003
Location: Georgiana, AL.
Posts: 239
Well, I was usually the one that suggested the "show me scenario "
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 On

Forum Jump


All times are GMT -4. The time now is 06:07 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.