not sure what post you're referring to; if it's Mike B's reply from 7 years ago, I'm not sure he's on this site anymore.
At any rate, there seem to be multiple ways to access the parallel port; have you already chosen and used one?If so, and you're only looking for a way to create a timed loop to write a sequence of values to it (alternating 0 and 1 pattern to pulse, I'd presume)
here's a quick VBA macro to demonstrate a simple countdown loop:
It'll start looking at the value in I1, wait 100ms, decrement I1 by one, and repeat until I1=0. You would just have add code in that loop to perform the write operation to the parallel portLet me know if that's helpful at all. If the actual I/O is also something you're looking for, I'd have to dig a bit deeper, I'm sure I could come up with a way.
sounds like a fun project! Just quickly here, in the sheet I gave you, when you click the "start" button next to I1, it should decrement whatever number is ***** I1 before your eyes, one count every 100ms, until it reaches 0. Then you can enter another positive number, click "start" again and it'll start over. It's a very short vba program, have you had a chance to look at the code?
Note that since it's a macro-enabled (i.e. containing vba code) workbook, you'll probably get a security warning when you open it and have to allow it to run the vba content for this all to work, of course.
But I see the bigger issue will be accessing the parallel port. I'll have to do a little R&D on that. What kind of PC and OS version are you running on?
I'm so sorry, I sent the wrong link to the non-macro version of the file (totally useless) Let's try again:
We'll figure out the proper logic to leave the formulas intact and have the "action" use their values at runtime.
Althought the theoretical upper clock rate in this environment would be 1kHz, as the delay through the loop is specified in an integer value of milliseconds,
in reality it is probably 64Hz, as that is the resolution of the standard windows OS timer (15.6ms)
If you really need something faster, we'd probably have to leave the Excel environment and get more involved.
I'm sorry for the delay; as it turns out my computer's parallel port expansion card doesn't work since my Windows 10 upgrade; so I don't have an easy platform to work this out at the moment. I hope to be able to dust off an older box this weekend and give it a try. However, if you've lost patience and have moved on, please let me know; I'd understand.
Good news! I was able to get my old computer running and figured out how to control the data bits on the parallel port from Excel - I was able to generate a square wave on D0, it was a frequency of 32Hz since the the bit has to be on for 15.6mS and then Off for another 15.6 ms for a complete cycle.
This experiment is here:
You will have to install the inpout32.dll that is here:
I found this here:
I just ran the InstallDriver.exe in the WIn32 folder - note that even though you're on 64-bit Windows, I'm pretty sure Excel still runs as a 32bit application, so installing the 32bit dll should be all you need.
Please have a look and maybe try to run the code on your machine, see if you get a square wave on D0 (pin 2 on the DB25 connector) for a couple of seconds when you run the test() macro from the VBA editor window.
Let me know how it goes and if you want to proceed further...
seems like we're in some choppy waters with the 64-bit OS and somewhat older libraries. I have tried running the excel file I gave you on a 64bit machine and get the same(?) error - inpout32 not found
I tried a couple of things but finally it stopped giving me this error when I copied the file
found in the original Win32 folder I gave you, to the folder
Give that a try! ... and let me know what happens. If the excel macro runs without errors, check your output pin to see if it's in fact pulsing while the macro runs.
Once we get past this hurdle, I'll look into your other issues...
Hi Paul,yes, sadly there's no amount of software tinkering that will overcome a missing hardware component :-) Glad to hear you got it to work, and thank you for the payment and added bonus, and you don't owe me any more for the effort so far (and including the remarks below)
Oddly it wouldn't let me post the text I had written "below", so here it is in a separate document for you to read: