Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Forums > Electronic Projects Design/Ideas/Reviews


Electronic Projects Design/Ideas/Reviews Are you building an electronic project or want to? Maybe you need some assistance? Come and submit your electronic questions here and let our experienced members find a solution.

Reply
 
Tools
Old 9th May 2009, 01:41 PM   #1
Question using Com port for signalling

Hi all

I am new on here and may not be in the right section, but here goes anyway.

This one is related to computers: Is there a program or application written that will produce a momentary high (assertive +12v) on the RTS (or DTR) pin (relative to the ground pin) on the com port on a PC (running XP Pro), after certain periods of time.

I need to be able to enter four sets of h/mm/ss times that, when reaching zero after counting down, cause the rts (or dtr) pin to go momentarily high, thus there will be four pulses issued as each counter in turn reaches zero. These four timings would all start together, as if the timers are all operating in parallel. The duration of the output pulse isn't critical, 250-500ms is fine.

Settings, for example, might be: Timer 1 - 00h:03m:18s, Timer 2 - 00h:08m:51s, Timer 3 - 02h:00m:30s, Timer 4 - 02h:06m:10s.

The com output pin will be coupled to an external controller incorporating a npn transistor to close a relay.

The timing needs to be started via the serial port also, possibly by grounding the DSR pin.

The initial timing start would not be related to time of day i.e can be started anytime.

Hope someone can help me or perhaps direct me to a more appropiate site for this project.

Thanks
xiptron is offline  
Old 9th May 2009, 08:18 PM   #2
Default

I think you'd have to write code for that it might be a little too single purpose to just find code for it out there already. Are you familiar with C programming at all? It shouldn't be excessively difficult to program something like that.
__________________
"Because I be what I be. I would tell you what you want to know if I
could, mum, but I be a cat, and no cat anywhere ever gave anyone a
straight answer, har har."
Sceadwian is online now  
Old 9th May 2009, 09:49 PM   #3
Default

If you can find a routine, or write one, that toggles those lines individually (then exits), you can use the Windows XP scheduling feature to execute it. There may even be DOS commands to set the DTR and DSR lines on a com port which you could execute using the XP scheduling feature to execute.
ccurtis is offline  
Old 10th May 2009, 04:17 AM   #4
Default

Thanks guys, I knew it would be a curly one, that's why there's nothing out there that I can find will do the job. The nearest are timers for irrigation purposes tec, but they are linked to time of day and don't do seconds either.

Sorrry, but I know NOTHING about programming - I'm a complete dummy in that regard.

This has been frustrating me for a long time, and until I can do it on the pc I am having to punch numbers into hardware type timers.

Beyond my original request, I also need to be able to recall about six sets of entries as they are often repeated.

Now that's really setting me apart lol!
xiptron is offline  
Old 10th May 2009, 08:13 AM   #5
Default

If you are prepared to have your PC running 24 hours/day why not google for some "PC controlled relays" there are a lot of kits and cheap prebuilt units out there.

And there is also freeware/shareware for your PC that lets you turn the relays on and off at specific times of day. This is a very common application and is well supported by the kits and shareware market.
Mr RB is offline  
Old 11th May 2009, 03:10 AM   #6
Default

I threw the attached program file together. It has fixed time delay values of 60, 12, 90 and 16 seconds hard-coded. If the program suites you, I can modify it to have the time delay values read from a file. The timers start when the DSR input changes state. You can test it by shorting RTS to DSR. When each timer expires, a 500 ms pulse is output on DTR.

It uses the COM1 PC serial port.
Attached Files
File Type: zip MULTIT~1.zip (21.4 KB, 36 views)

Last edited by ccurtis; 11th May 2009 at 04:30 AM.
ccurtis is offline  
Old 16th May 2009, 12:44 PM   #7
Default

Thankyou ccurtis. This seems to have promise, even though I haven't the foggiest idea of how to implement it yet. I presume it just runs by shorting the pins - is there anything else I need do?

I need to run 4 or 5 timing periods at a time, and they must sequence off each other after starting the first one.

I could put the timings in as text or code that would be good. tell me more, I am intrigued by the apparent simplicity of your program.
xiptron is offline  
Old 16th May 2009, 05:39 PM   #8
Default

You can short the RTS and DSR pins together, or bring the DRS pin to +5 to 12 volts. That's all you need to do to start the timers. I suggest you run and test the program attached before going any further. Yes, I would have the program read a timing set from a text file you can create with any text editor, like Wordpad for example.
ccurtis is offline  
Old 19th May 2009, 08:17 AM   #9
Default

Well, bless my cotton-pickin' socks ccurtiss! It works great!! I can use it I think.

Here are some requests:

1. You have the times entered as seconds - can it be arranged to shows these as h:ms:ss?

2. As you have them, the timers are operating in parallel. That's ok, but a refinement for my application would be to have them sequencing i.e. T1 triggering T2 and so on. If not, I can use the parallel system ok.

3. Is it possible to have the program remain on screen after ending, with the timers resetting back at the entered values? (rather than running the script again).

4. Would it be possible to recall various "sets" of values? For example, a Timer set of 1 to 6 for one application, then another set of T1 to T6 with different values.

(I don't want to load you up with too much redevelopment of course, but I do repeat a lot of the same operations so easy recall of "sets" of times would be great.)

5. Lastly, is a Windows GUI possible? (don't hit me lol)
xiptron is offline  
Old 19th May 2009, 08:23 AM   #10
Default

Well, bless my cotton-pickin' socks! It works great!! I think I can use it.

Here are some questions/refinements:

1. You have the time entered as seconds - can it be arranged to show these as h:mm:ss? (even if entering as seconds)

2. As you have them, the timers are operating in parallel. That's ok, but a refinement for my application would be to have them sequencing i.e. T1 triggering T2 and so on. If not, I can use the parallel system ok.

3. Is it possible to have the program remain on screen after ending, with the timers resetting back to the last entered values?

4. Would it be possible to recall various "sets" of values? For example, a Timer set of 1 to 6 for one application, then another set of T1 to T6 with different values.

(I don't want to load you up with too much redevelopment of course, but I do repeat a lot of the same operations so easy recall of "sets" of times would be great.)

5. Lastly, is a Windows GUI possible? (don't hit me lol)

Many thanks
xiptron is offline  
Old 19th May 2009, 11:36 PM   #11
Default

Quote:
Originally Posted by ccurtis View Post
Yes, I would have the program read a timing set from a text file you can create with any text editor, like Wordpad for example.

Despite my complex wish list, I could get by with just loading the time values as you described above. Can you describe how to do this with a text editor. I am anxious to get this going. Thanks so much.
xiptron is offline  
Old 20th May 2009, 12:53 AM   #12
Default

I'll have some time this weekend to work on it. The Windows GUI is out of the question with the tools I have handy here. You probably noticed that the program hogs most of the cpu. That is the nature of the beast. I take it that is tolerable to you. The parallel system should suffice as you can simulate one timer triggering the other by setting the timers to end after any delay you want to and since the timers are started together, all at the same time. I'll do the remaining refinements.

I'll give an example text file to show how to enter the time delays for each timer. I assume four timers are enough, but more can easily be added.
ccurtis is offline  
Old 20th May 2009, 04:17 AM   #13
Default

All good. Dos is fine as I can dedicate a spare comp to running just the prog. CPU usage doesn't matter. I have wired the interface and it's all set to go. I am using a 1300E sensitive reed-relay in series with a led which closes from RTS to Pin 5. That works fine, you couldn't get a more simple interface.

Can you program it for six timers? This will give me room to add some extra commands I've always needed.

Having the displays read h:m:s lets me know at a glance how long I have to go in real time on the longest periods.

Parallel operation is ok, it's just means that if want to, say, shorten the duration of Timer 2, then I have to shorten the following timers T3, T4 etc by the same amount.

I think this will make more sense when I explain that with each timer, the countdown is always progressively longer e.g T1 3m 18s, T2 7m 56s, T3 1h 30m 45s, T4 1h 47m 34s etc. Obviously then sequencing the timers, and altering only one, avoids having to also alter the others. (Individual periods would be entered for each one, as opposed to running-totals when in operating in parallel).

Anyway, I'm happy to give your updated ver a whirl. I'll check in later . Thanks again.
xiptron is offline  
Old 23rd May 2009, 01:15 AM   #14
Default

I have worked out that I need 8 timers max. Thanks.
xiptron is offline  
Old 23rd May 2009, 03:16 AM   #15
Default

Quote:
Originally Posted by xiptron View Post
I have worked out that I need 8 timers max. Thanks.
Okay. (yer killin me)
ccurtis is offline  
Reply

Tags
port, signalling

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
programmer serial port vs. laptop with usb port crys Micro Controllers 9 18th January 2008 01:52 PM
Signalling rate & data transfer rate? Celestie84 General Electronics Chat 2 17th June 2004 07:36 PM
Operate a relay from a PC port RS232 or Parallel port Eddie ESV Electronic Projects Design/Ideas/Reviews 2 12th June 2004 08:43 AM
[ann] COM Port Toolkit - serial port monitoring on Win32 PCs MGolikov Electronic Projects Design/Ideas/Reviews 0 6th April 2004 07:17 AM
Designing a circuit to convert game port to serial port Diluka Moratuwage General Electronics Chat 1 29th July 2003 05:40 PM



All times are GMT. The time now is 04:37 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker