??? 05/17/04 10:03 Read: times |
#70468 - RE: INFO: RS485 and Win9X RTS toggle option Responding to: ???'s previous message |
Hi Hans van Pelt,
Thanks for your reply. Your reply gave me some more insight into the Windows OS, Thank you. I have some more query: As per the MSDN link you gave, following is the extract: VOID Sleep( DWORD dwMilliseconds ); Parameters dwMilliseconds [in] Minimum time interval for which execution is to be suspended, in milliseconds. Well Microsft says it is the minimum time , but sometimes I get a delay which is less than the specified(100mSec); that IS the problem in Windows 98, but NOT in WindowsXP. You can compare the results that I have posted. My requirement is: the routine must give a minimum delay (maynot be exact, but minimum) between 2 consecutive bytes send on the Serial Port. If that delay is reduced (due to any reason whatsoever), my instrument looses some bytes in between. Now, my MCS-51 is having the priority set for Serial Port. But there are other very critical ISRs which require priorities set to 1. I put in lots of energy and have almost tried all the tricks in the book and have come to the conclusion that I need to give a delay between 2 bytes sent on the Serial Port by PC. After this decision, we have implemented the necessary changes; And the system is working well since 2 years, on almost all types of Operating Systems, various PC speeds and various environments. So no issues any changes in my system as of now. My intention of putting this problem of Sleep(100), was just to inform the members that in Windows98, the Sleep(100) may not work perfectly well, but works well in WindowsXP. So whether it is a bug or not, well, please be careful when using it. I have wasted my enough of valuable time and energy in finding it out, I wish that you do not waste the same in reaching the same conclusion as I did. I do not wish to debate on the issue whether Sleep(100) is a wrong place to use in Windows98, or whether it is a bug of Microsoft in coding their Operating System or whether it is a problem of documentation of Microsoft. The point is clear that: Sleep(100) does not work properly (sometimes) in Windows98 but works well on WindowsXP everytime. with best regards from, Mr. Kiran V. Sutar. |