Topic : 3 questions about ARM C

Forum : ARM

Original Post
Post Information Post
December 2, 2010 - 5:53pm
Guest

hello , I am using RIDE7 for STM32
I have 3 questions ;

1 ) what does the strchr function return when it cannot find the character in the string ?
I used NULL but RIDE7 doesnto know what is NULL

2 ) how is float variable defined in RIDE7 ? ( I mean for char we use int8_t , what do we use for float ?)

3 ) do I have to add a library or include file for using math functions like sqrt () ?

Replies
Post Information Post
+1
0
-1
December 3, 2010 - 2:54pm
Raisonance Support Team

Hi,

Here are some answers to your questions:

1) strchr returns NULL, which is defined in stdlib.h (you need to #include stdlib.h and string.h)

2) int8_t and the like are defined in stdint.h, which has been defined by the C99 standard. There is no standard typedef for float and double.

3) sqrt and his friends come from math.h.

Best Regards,

+1
0
-1
December 30, 2010 - 10:50pm
Guest

hello , I have another question

void Delay(__IO uint32_t nCount);

what does "__IO" mean in this declaration ?

by STM32 at 72 Mhz how many microseconds is Delay(1) ?
does it change if I call it in an interrupt service routine ?

is there an inline assembler code for delaying ?

+1
0
-1
January 3, 2011 - 9:10am
Raisonance Support Team

Hi,

The __IO is just a macro defined in the STM32 Firmware libraries. Just rigfht-click on it and select "Go to definition" under Ride7 and you will see that it just defines the variable as "volatile".

The Delay() function from our examples is not properly calibrated. Its goal is only to wait for a given period of time, hence it just loops doing nothing a given number of times. You will have to manually calibrate it if you need some specific precision. However, the calibration will change if you recompile the application with a different optimization level, so you should not consider our Delay() function as acurrate.

If precise delays are required, you should consider taking advantage of the the STM32 timers.

Best Regards,