We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello,
can anyone tell me if can I use threads and timers (like in C/C++) on LPC2361 and where can I found some demo/examples/manuals about that?
Thanks
Have you checked the reference material Keil has? What was your thought about Keil's RTOS?
Dear Per Westermark
Thank you for response. I confess that I dont have too much informations about Keil's RTOS. I will read more about and I will come back.
What do you mean by "like in C/C++"?
Threads and Timers have nothing to do with any particular programming language!
Dear Andrew Neil
I mean software timers/threads not hardware timers like the four of LPC2361. Multithreading, multitasking etc. Sorry if I was ambiguous.
Dorin
Of course you can - if it's just software then you can "just" write it!
Any decent RTOS would provide these features - and there are plenty of RTOS available for LPC processors.
A "software" timer requires some sort of hardware "timebase" input - usually a hardware timer.
Example: www.8052.com/.../144417
Dear Andrew
the example you sent me have one big problem: when you run a function from one timer the other timers dont work. And some functions can take a long time. If an other function need to be run at very precise moment you have a problem. Basically you have only one loop actually and all is syncronized. Tell my if I am wrong.
"when you run a function from one timer the other timers dont work"
So don't do that, then!
That was just a very simplistic example to give you the idea.
"And some functions can take a long time"
So, indeed, you would not call them direct from the timer code!
You could, just as one example, set a flag to indicate that the timer has expired - and test that flag in your main loop...
// The countdown is running if( --timer_1 == 0 ) { // The countdown has reached zero; ie, the timer has expired // Set flags and/or call functions as appropriate }
"as appropriate" is the key phrase there!
www.8052.com/.../144417
you right. The only way is to make sure that the required time is at most or less than the available time. So you must provide in time escape from any running sequence. But will be harder to program :(. That's why they invented multithreading, that you don't worry about that. No offence, I hope
Forgive me I forgot to say thanks for help. Thanks man. I appreciate your help.
Can i know how to do multithreading in it?