14.11.2014 Views

P89LPC935 Microcontroller Tutorial - gmitWEB

P89LPC935 Microcontroller Tutorial - gmitWEB

P89LPC935 Microcontroller Tutorial - gmitWEB

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Generating Delays (1)<br />

• Use a for loop<br />

– Does not use any timer resources<br />

– Uses CPU resources while running<br />

• i.e. no other task can be performed during delay loop<br />

– Can result in large amounts of machine code being generated<br />

– Results may be different for different compilers<br />

• The following code results in a half second delay for the <strong>P89LPC935</strong><br />

operating off the 7.373MHz RC oscillator<br />

void delay()<br />

{<br />

unsigned int i;<br />

for (i=0; i < 50000; i++);<br />

}<br />

Diploma Project <strong>Tutorial</strong> 28

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!