Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

timing parallel pins

Status
Not open for further replies.

xiptron

New Member
Hi all. I have a unique challenge that I can't find an answer to on the net. I have NO experience with programming so am relying on those with the knowledge to help me. I think I need a small program written to do my task.

I am interfacing a standard printer port to a video projector so I can control the functions of zoom, shift, etc by using my pc. So far it works well, with a hi from pins 2 to 9 (data 0 to 8) turning on npn transistors wired across the pressure pads in the projectors remote-control (there is no serial access these functions).

However, I want to "time" the various outputs to stay on for fixed durations, rather than triggering and holding the outputs high by generic software switches.

Is it possible that a small program could be written (in C?) to time each required pin high for a certain time?

Here is the sequence I need:

PRINTER PORT
Step 1 - Pin 9: take high for 1 second.
Step 2- wait 1/4 second
Step 3 - Pin 8: take high for 9 seconds
Step 4 - wait 1/4 second
Step 5 - Pin 6: take high for one second
Step 6 - wait 1/4 second
Step 7 - Pin 5: take high for 5 seconds
Step 8 - wait 1/4 second
Step 9 - Pin 2: take high for 3 seconds

The wait states are due to the projectors need to handle these commands in sequence, i.e. not all at once.

To get timings accurate I need to be able to vary each one by several seconds either way. Perhaps if the timers could be programmed from say 1 to 10 seconds (and down to 1/10ths), that would allow me to determine and set the best times for each function. The wait states could be set at a fixed duration - anywhere from 1/4 to 1/2 a second is fine.

The ability to recall several sets of settings would allow me to callup a different set of timings, should I need them. The program needs to remember all settings and memories. I don't mind if it has to work in a DOS box (I am running XP SP3).

The most tricky thing I think is the need for the timers to work in the steps given. So Timer 1 needs to start first, then it hands over to 'wait', then Timer 2 starts and it hands over to wait and so on till the end, when everything can remain low (off).

If all works as intended, the projectors image will have zoomed in, shifted up and slightly to the right, to position a 2.35 aspect-ratio dvd image centrally on a 2.35 ratio screen. The settings are peculiar to this particular brand of machine when changing from 1.85 widescreen.

As far as starting the sequence, I need it to start from an external momentary switch closure. Could one of the unused 'input' pins on the same parallel port be used for this instruction?

I hope this hasn't been too long and boring for the reader (or this great forum) but I think you can see this is a quite a simple solution in the end run, as compared to going the plc or pic ways, which I just cannot afford to do!

Many thanks in advance for any help.
 
Last edited:
What operating system? I know how to do this in XP and prior versions. Not so easy in newer versions
 
Last edited:
Mr Eric Gibbs, who frequently posts on this site, is the resident expert on this.

You will need a free down-load of Visual Basic, and Eric's DLL, to get programmatic access to the parallel port. It has several pins for output, several for input, and some that are in/out.

To find Eric's stuff on electro-tech-online.com, do the following steps:

1. Go to the Google Start Page, click on the Advanced Search button.

2. Paste the following line into the ALL THESE WORDS box:
"ericgibbs" visual basic parallel port

3. Paste the following line into the SEARCH WITHIN A SITE OR DOMAIN box:
http:/www.electro-tech-online.com/

4. Click on the Advanced Search button.
 
Last edited:
Eric, ParaTimer v2 could be the basis for what I need (updated 6 Sept 0500 GMT).

To make more suited:

1. definately add seconds and .1s ability e.g 00:00:00:00
2. My start time is unrelated to the time of day. For example, I will want to start Timer "0" at 00:00:00:00 so this would need a manual start button (which disables trigger by system clock)
3. add remote start ability - (if checked disables trigger by system clock)
4. remove Zone 2 and 3 tables as they are not required (optional)
5. enable renaming of 'Zone'
6. Reverse order of timers so 0 is at top, 7 at bottom
7. add 'save as' capability

Is all this possible?

As an interem measure I could live with adding seconds and the manual/remote start ability.

xiptron
 
Last edited:
hi,
Give this a try, ensure that the VB5 runtime files that are required for the ParaTimer2 are loaded into the Windows/System folder, also this inpout32.dll.
[changed the extension to .txt so the upload will be accepted, change it back to .dll

Name the folder 'ParaTimer2' and copy the 'ParaTimer2.exe' and test1.txt' into it.
 

Attachments

  • ParaTimer2.exe
    74.5 KB · Views: 240
  • inpout32.txt
    32 KB · Views: 139
  • test1.txt
    104 bytes · Views: 129
  • AAesp01.gif
    AAesp01.gif
    12.4 KB · Views: 284
Hi Eric

Many thanks for the v2 modification. I have been putting it to the test and it's working very well and does the job needed. Good work Sir.

I like the way it continues to count between the ends and starts of successive periods as these 'gaps' can double for my wait states to allow the projector to switch modes. The projector quite happily switches with only .1s elapsed between the boxes (and I was allowing for 1s!).

The following are some minor issues remaining that you may like to consider for attention (I would appreciate very much);

1. The remote "run" connection is really needed - and I have a n.o. contact waiting to connect to it!

2. Rather than leaving the time counting up on the display, could the counter stop with the end of the sequence (i.e. at end of last selected timer)? Also, a "reset counter" button would enable 000.0 before re-starting.

3. Can you colour the counter numerals green with the black background as in ParaTimer 1.

4. Would you consider putting in a global reset button? Currently, if a sequence is abandoned after starting, there is no way to reload from the start. It seems to need to time right out before the file can be reset.

5. Selected checkmarks for 'connect-pin' are not being recalled between different saved files i.e they stay in the same boxes.

6. Can you add a 'Save' for when editing an existing file.

7. Can you add a 'Exit' only command i.e. no save before Exit.

8. If you provide 'Save', 'Save As' and 'Exit w/o Saving' options then the rather scary 'Exit and Save' can be removed.

Btw, the portdll.dll file was missing from your send pack. I borrowed one from V1!

Brian
 
Last edited:
Hi Eric

Many thanks for the v2 modification. I have been putting it to the test and it's working very well and does the job needed. Good work Sir.

I like the way it continues to count between the ends and starts of successive periods as these 'gaps' can double for my wait states to allow the projector to switch modes. The projector quite happily switches with only .1s elapsed between the boxes (and I was allowing for 1s!).

The following are some minor issues remaining that you may like to consider for attention (I would appreciate very much);

1. The remote "run" connection is really needed - and I have a n.o. contact waiting to connect to it!
This change is under test at the moment
2. Rather than leaving the time counting up on the display, could the counter stop with the end of the sequence (i.e. at end of last selected timer)?
I will check this out
Also, a "reset counter" button would enable 000.0 before re-starting. It would look cleaner.
A Reset button has now been added
3. Can you colour the counter numerals green with the black background as in Paraport 1.
OK, will do.
4. Would you consider putting in a global reset button? Currently, if a sequence is abandoned after starting, there is no way to reload from the start. It seems to need to time right out before the file can be reset.
A Reset button has now been added
5. Selected checkmarks for 'connect-pin' are not being recalled between different saved files i.e they stay in the same boxes.
OK
6. Can you add a 'Save' for when editing an existing file.
Yes
7. Can you add a 'Exit' only command i.e. no save before Exit.
Yes
8. If you provide 'Save', 'Save As' and 'Exit w/o Saving' options then the rather scary 'Exit and Save' can be removed.
OK
Btw, the portdll.dll file was missing from your send pack. I borrowed one from V1!
I saw that after I had posted!!

Brian

hi,
Give me a couple of days to finalise/test the changes.
The remote start/stop is on pin #11 of the parallel port, normally high, pull low and hold to start, release to stop.
 
hi Brian,
Give this version a try.
 

Attachments

  • AAesp01.gif
    AAesp01.gif
    13.3 KB · Views: 176
  • ParaTimer2.exe
    92.5 KB · Views: 115
Thanks Eric. Having trouble though, I can't get this one to run. Getting Runtime error 76 (can't find path). It's in a new folder with the original dllport.dll and the original inpout.dll is in W\System, but do these two files need updating? (I tried overwriting V1 with this one but that didn't work either).

While you're checking, can you remove the '1' after ON1 and OFF1, and change 'Halt' to STOP.

It's looking great and can't wait to try out!

Brian
 
Last edited:
Thanks Eric. Having trouble though, I can't get this one to run. Getting Runtime error 76 (can't find path). It's in a new folder with the original dllport.dll and the original inpout.dll is in W\System, but do these two files need updating? (I tried overwriting V1 with this one but that didn't work either).

While you're checking, can you remove the '1' after ON1 and OFF1, and change 'Halt' to STOP.

It's looking great and can't wait to try out!

Brian

hi,
The program "ParaTimer2.exe" should be in the "C:\ParaTimer2" folder, can you confirm this.???

The dll's in the Windows/Sysytem32 folder, are common to all my parallel port programs.

EDIT:
Added a zip file, unzip and load ALL the files into a "C:\ParaTimer2" folder
 

Attachments

  • brian1.zip
    31.2 KB · Views: 120
Last edited:
Hi Eric

Ok now, all working. I didn't have it C:\Paratimer, but the previous versions which were working were in a folder far from c:!

Please confirm if dllport.dll should be in System or System32? (I've now put it in both)

Still some niggles though;

1. The output connect checkboxes are not saving/not being recalled. The same pins stay selected regardless of input file. All other parameters are being recalled ok.

2. The remote start is great. But can you change it so that when the remote relay/switch is opened, the counter stops at that time (as it does in button run), rather than resetting. In fact, could you make it that I had selectable option in another checkbox (Count stop/Count continue)? The logic here is that if one wasn't observing the timer, you'd know that it had actually done the routine.

Thanks for the minor cosmetic changes.

Brian
 
hi,
The saving and recall of the output check boxes works every time for me.???

I assume you are saving the individual files with a different name after each is being set up.?

EDIT:
I can see whats happening, get back to you.

EDIT2:

Unzip this brian2.zip, it also includes 10 test.txt files

I will look at the counter stop later.
 

Attachments

  • brian2.zip
    31.8 KB · Views: 127
Last edited:
Yes Eric, Brian2 has solved the checklist recall problem. It's working good now.

It was very worthwhile incorporating the 1/10s capability. Several of my timings need s+msecs for best fit as the lens motor has good repeatability and returns to the same places each time. I have also saved a reversing routine to set the lens back at 'normal'. Curiously, the timings are slightly different and probably due to the way the gearing etc works. I have only needed to create two files to store all these settings: zoom.txt and reset.txt.

p.s. should the dllport be in System or System 32?
 
Last edited:
Yes Eric, Brian2 has solved the checklist recall problem. It's working good now.

It was very worthwhile incorporating the 1/10s capability. Several of my timings need s+msecs for best fit as the lens motor has good repeatability and returns to the same places each time. I have also saved a reversing routine to set the lens back at 'normal'. Curiously, the timings are slightly different and probably due to the way the gearing etc works. I have only needed to create two files to store all these settings: zoom.txt and reset.txt.

p.s. should the dllport be in System or System 32?

hi,
To ensure that all/other programs calling these dll's can find them OK, I put the dll's in both...
 
With regard to my request to allow the counter to continue running once the remotely-started period has ended: - don't worry, it's fine the way it is.

Instead, can we change the manual run so that when it has ended, the timer resets to zero in the same way (presently it runs on until STOP is pushed). This means that you would use the end of the last active timer as the cue to zero/reset the manual routine.
 
Last edited:
Have you any thoughts on implementing this last change?

"Instead, can we change the manual run so that when it has ended, the timer resets to zero in the same way (presently it runs on until STOP is pushed). This means that you would use the end of the last active timer as the cue to zero/reset the manual routine".
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top