hello guys
i would like to inetrface parallel port to my driving circuit(SCR).for that i need 150hz square wave with 50% duty cycle in digital data lines.In vb i tried to make the same but i was not able to make 150hz in parallel port. instead i am getting only 32 hz. i used both sleep and timer routines in vb. though i passed correct ms in parameters in function,i couldnt make 150 hz cycle
i tried same in vc++,c . i got same 32 hz only i dont know what was wrong on that
can any one suggest me to over come the problem.
i am using normal LPT(0x378) what about EPP is it give any probs(above)
The sleep and timer routines do not give enough precision to get down to 150 Hz because the they are based on a time interrupt which occurs approximately once every 40 or 60 ms or so. In fact the normal timers are not very precise in windows and are low priority messages that windows doesn't process immediately.
You should probably use QueryPerformanceCounter and QueryPerformanceFrequency to make a high resolution timer on windows. Check out
In modern Windows you can usually increase the timer interrupt resolution to 1.0ms, but unfortunately that value doesn't multiply cleanly to give 6.667ms period required for 150Hz.
To set the timer resolution and start a timer interrupt callback, use Win32 functions timeBeginPeriod and timeSetEvent. When you are done, use timeKillEvent and timeEndPeriod.
thank you all
i will check out above link and ask u if any doubt. pls help me out
Added after 1 hours 39 minutes:
hello jonathan
thnx for ur suggestion but i think this timer link would be a VC++ related one.but i need VB timers other than sleep and timer components. can u pls send me VB code to gen 150hz on LPT
and what is EPP,ECP port are there any differents
bt normol one and EPP,ECP.
Added after 8 minutes:
hello echo47
thanx for ur suggetion and my problem is when i pass 6ms to sleep instruction i get only 32hz . if pass
50ms to sleep ins i get exact frequency(1/50ms) 20hz that is if i pass parameter above 30ms to sleep instruction i am getting exact frequency wave . but below 30ms i am getting only 32hz(1/30ms) i dont know what was the problem. can u pls give solution to the problem.