1 / 2

Incorrect

Incorrect. void hw_msDelay (unsigned int mS ) { unsigned int tWait , tStart ; tStart = ReadCoreTimer (); tWait = ( CORE_TICKS_per_MS * mS ) + tStart ; while (( ReadCoreTimer ()) < tWait ); LATBINV = LEDA ; }. void hw_msDelay (unsigned int mS ) // better names {

noura
Download Presentation

Incorrect

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Incorrect void hw_msDelay(unsigned intmS) { unsigned inttWait, tStart; tStart=ReadCoreTimer(); tWait= (CORE_TICKS_per_MS * mS) + tStart; while((ReadCoreTimer()) < tWait); LATBINV = LEDA; } void hw_msDelay(unsigned intmS) // better names { unsigned inttStart, tStop, tWait; tStart=ReadCoreTimer(); tWait = (CORE_MS_TICK_RATE * mS); tStop = tStart + tWait; while(ReadCoreTimer() < tStop); LATBINV = LEDA; }

  2. Correct Method void hw_msDelay(unsigned intmS) { unsigned inttStart, tWait; tStart=ReadCoreTimer(); tWait = (CORE_MS_TICK_RATE * mS); while((ReadCoreTimer() - tStart) < tWait); LATBINV = LEDA; // Toggle LEDA }

More Related