GCC has a function "delay ()" default / standard?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GCC has a function "delay ()" default / standard?

1,648 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Luis Digital on Wed Jan 18 12:35:05 MST 2012
Hello,

GCC has a function "delay" that is portable?

Thanks.
0 Kudos
Reply
7 Replies

1,624 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Rob65 on Thu Jan 19 14:56:11 MST 2012

Quote: Luis Digital
Finally I'm using the kernel timer (SysTickTimer), the manual says it is a standard form.



The systick timer is a timer that is a standard peripheral for all M0/M3 processors. So if you buy an Arm Cortex M3 from TI, NXP, Renesas, ST or whatever other silicon vendor, they will all contain the systick timer.

This is done in order to allow for easy porting of different operating systems. They can use the systick timer to generate a "system tick" used for the scheduler.
Using the systick in your own program is perfectly valid but be aware that you may (will) run into problems when you use the systick timer and later on want to place the whole thing on top of some OS.

I use systick as a 1 msec interval timer for the scheduler. Most timers run as software timers in the OS, when timing is more critical I use one of the timers in the lpc1754.

Regards,
[INDENT]Rob
[/INDENT]
0 Kudos
Reply

1,624 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Luis Digital on Thu Jan 19 14:42:42 MST 2012
Finally I'm using the kernel timer (SysTickTimer), the manual says it is a standard form.
0 Kudos
Reply

1,624 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Luis Digital on Thu Jan 19 06:54:54 MST 2012

Quote: TheFallGuy
Presumably free pascal runs on a host operating system...



Free Pascal runs on microcontrollers as well (AVR, ARM), but do not know if they have support for delays.
0 Kudos
Reply

1,624 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Thu Jan 19 00:20:05 MST 2012

Quote: Luis Digital
Boys are not so negative, please.:)

Free Pascal for example, often implements the same functions for all systems.

I know that the compiler does not know, but humans.;)

Thanks for your comments.



Presumably free pascal runs on a host operating system so can use the facilities of that os. If your application was running on an operating system, it could do the same.
0 Kudos
Reply

1,624 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Luis Digital on Wed Jan 18 20:34:33 MST 2012
Boys are not so negative, please.:)

Free Pascal for example, often implements the same functions for all systems.

I know that the compiler does not know, but humans.;)

Thanks for your comments.
0 Kudos
Reply

1,624 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Wed Jan 18 16:03:59 MST 2012
How can it? The compiler doesn't know the clock speed of your part, or how many wait states of the memory the code is running from (flash/ram), or whether there is cache, or ...
0 Kudos
Reply

1,624 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Rob65 on Wed Jan 18 15:14:26 MST 2012
No,

timing in programs is never portable.
You have to use one of the hardware timers or systick in order to create a delay that is accurate.

Rob
0 Kudos
Reply