Sleep issues

Discussion specific to the ZX-1281 and ZX-1280 microcontrollers as well as the ZX-1281 and ZX-1280 Dev Boards.
Post Reply
pjc30943
Posts: 220
Joined: 01 December 2005, 18:45 PM

Sleep issues

Post by pjc30943 »

Anyone else experience problems with calling sleep with longer time lengths?

For example, sleep 500.0 will cause a delay much shorter than 500s.

Is there an upper limit?
mikep
Posts: 796
Joined: 24 September 2005, 15:54 PM

Re: Sleep issues

Post by mikep »

pjc30943 wrote:For example, sleep 500.0 will cause a delay much shorter than 500s.

Is there an upper limit?
Yes. If you look at sleep() it takes an unsigned integer - 16 bits. Each tick is 1/512 of a second. Therefore the maximum sleep time is 65536/512 = 128 seconds.
Mike Perks
pjc30943
Posts: 220
Joined: 01 December 2005, 18:45 PM

Re: Sleep issues

Post by pjc30943 »

mikep wrote: Yes. If you look at sleep() it takes an unsigned integer - 16 bits. Each tick is 1/512 of a second. Therefore the maximum sleep time is 65536/512 = 128 seconds.
Ah. Of course... Thank you.
Post Reply