You can use the built-in function _delay_cycles . It will delay cycles not secods, so you will have to a bit of math first. I don't know your board, but if I searched correctly its 8MHz. This means it goes through 8 000 000 cycles in 1 secod. If you delay 8 000 000 cycles, you will have waited for 1 second. For 1 milisecond, divide it by 1000, 8 000 000 / 1 000 = 8 000. So I would say: 1 second: _delay_cycles (8000000); 1 milisec: _delay_cycles(8000); I hope you can use those in your project.
↧