想做个I2C通讯软件,现在基本框架已经搞定
 就是不知道怎么在VC中实现4.7us的延时,我又怎样
判断延时是否达到要求呀
  求高手指教!!!

解决方案 »

  1.   

    http://community.csdn.net/Expert/topic/3623/3623519.xml?temp=.1909601
      

  2.   

    BOOL QueryPerformanceFrequency(          LARGE_INTEGER *lpFrequency
    );ms-help://MS.MSDNQTR.2003FEB.2052/winui/winui/windowsuserinterface/windowing/timers/timerreference/timerfunctions/queryperformancefrequency.htm
      

  3.   

    QueryPerformanceFrequency
    QueryPerformanceCount
    精度比较高
      

  4.   

    http://xs.blogchina.com/article_117686.585707.html
      

  5.   

    CString strText;
    LARGE_INTEGER n64StartCount={0},n64StopCount,n64Frequency = {0};
    DWORD dwTotalTime = 0; QueryPerformanceCounter(&n64StartCount);
    QueryPerformanceFrequency(&n64Frequency); //这里加入你的操作 QueryPerformanceCounter(&n64StopCount);
    dwTotalTime = n64StopCount.LowPart - n64StartCount.LowPart;
    if(dwTotalTime < 0)
    {
    dwTotalTime += 2^32;
    }
    float WastTime = (float)(n64StopCount.LowPart - n64StartCount.LowPart)
    /(n64Frequency.LowPart + n64Frequency.HighPart * 2^32); strText.Format("时间消耗 %f",WastTime);
    AfxMessageBox(strText);