cancel
Showing results for 
Search instead for 
Did you mean: 

Can create the 1 us period with the timer 2 of STM8L051F3 ?

edmond yun
Associate II
Posted on June 28, 2018 at 07:13

Hello, 

I would like to make 1 us period with timer 2 of STM8L051F3.

currently I checked that 1 ms is correct, if trying to use under 1 ms (like 100 us or 10 us), the period is not correct....

I measured the period with GPIO(LED).....

please help to let me know whether can make 1 us period with timer 2 or not..

and if has another solution, please help to provide the example with detailed information...

thankful for your support in advance,

thanks.

#stm8l051f3
7 REPLIES 7
edmond yun
Associate II
Posted on June 28, 2018 at 07:23

at least, need to make 5 us....please help me,,,,

Posted on June 28, 2018 at 07:53

For practicalities sake you aren't going to be able to interrupt at 1 MHz (1us)

You can set a prescaler on the TIM to get the 16-bit portion to clock at 1 MHz, and then you can observe ticks of the counter.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
edmond yun
Associate II
Posted on June 28, 2018 at 09:04

and I am using 3 timer (2/3/4), so sometimes I need to set the priority of each timer,

I don't know the method, please help to let me know it with example.

and I wonder whether STM8L051F3 can support float calculation or not, please help to let me know the fact...

when trying to do 'printf('test %f \r\n', 0.12345);' in code, I can see only '%f' output... why ?

it is float support issue or printf library compile issue ?

thankful for your support in advance,

thanks.

henry.dick
Senior II
Posted on June 28, 2018 at 13:17

'

Can create the 1 us period with the timer 2 of  STM8L051F3 ?'

yes, if you can run that chip at 100s of Mhz.

Posted on June 28, 2018 at 13:29

'

why ?'

you may find it helpful to read your compiler manual.

Posted on June 29, 2018 at 13:58

Hello, Dhenry,

I give up it, instead I make another solution, currently I can control the gpio pin what I want,

thanks.

Posted on June 29, 2018 at 15:06

Perhaps you can use ftoa() to generate a string, and print that. Check compiler setting

Or create a Float2String() function.

Pretty sure the STM8 can support floating point, I was using floating point on 8-bit micros decades ago. The real issue is the size of the library code, and whether the application and part can, or want, to support that.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..