Discussion in "8051 Discussion Forum" started by    Amit Kumar Das    Sep 24, 2010.
Fri Sep 24 2010, 01:28 AM
Is there any easy to use, available RTOS to implement in 8051(AT89S52) ?
Fri Sep 24 2010, 03:06 AM
is RTOS means Real Time Operating System
Fri Sep 24 2010, 07:07 AM
Ya I think RTxtiny .I dont have keil installed,you can check in that help topics you will find it there . Or google free rtos you will get it at free rtos site .
Fri Sep 24 2010, 07:12 PM
its hard to use a kernel in 8051. 8051 is too small for a kernel type system.
I suggest to use state machine way of coding for best and faster working applications. you can also write state machines to mock multitasking
Fri Sep 24 2010, 11:58 PM
Is there any state machine software (with documentation and example) available for 8051 which can be interfaced to keil like QDK ?
Sat Sep 25 2010, 04:58 AM
Hai Ajay,Can you brief us more about the "state machine way of coding" and any related articles of study on that.

Sat Sep 25 2010, 10:03 PM
Read the txt file regarding state machine.
Sat Sep 25 2010, 10:10 PM
Sorry the attachment was not attached due to error.
Sat Sep 25 2010, 10:13 PM
Ajay Sir,

Can you post some example written in Keil C using state machine for S52 microcontrollers.
Mon Sep 27 2010, 09:06 PM
Its simple to implement, I will see if i can make a working example to put up on forum but for now just understand the logic.

You will have a variable that will hold the state of system.. say SysState. and there are few states depending on tasks your system is going to do..
simple example:
A task for keypad, LCD and an RTC.
Task1: Check for key and show time stamp on LCD when key is pressed
Task 2: Update Datetime on LCD
Task 3: process interrupted event (make a GPIO high/Low)

Possible SysStates:
A> Check key
B> Key Detected
C> Read RTC
D> Update LCD
E> Event Process

then a simple switch case statement in while(1) loop does the job..
case CheckKey:
//check if key pressed or not
//change state here if needed
case ReadRTC:
//read rtc here
//change state here if needed
//and so on...

Remember its always recommended not to spend too much time in ISR, coz you may miss other interrupts or interrupts may get delayed for a longer time. so State machine approach gives us this facility not to spend too much time rather you can simply change the state of your system to Interrupt.. and process that interrupt in main loop.

There is no/very less while loops in state machines, simple if conditions so that state machine is always in running mode never stops.

you can make use of multiple statemachines to mock up multitasking..

lets say
State machine 1: SystemState (Task1, Task2, Task3)
State machine 2: TaskState (Tas1state, Task2State, Task3State)
then each task1state may have sub states..

so whenever system state changes to a new task, you processor without a need of context switch starts executing code for it. for changing systems state you can make use of a timer which is fired at a fixed interval of time.

Hope you get an idea now
 Amit Kumar Das like this.
Tags state machine embedded system8051 state machine codingmultitasking through state machines

Get Social


Powered by e107 Forum System


Wed Apr 21 2021, 01:25 AM
Rolland Crocker
Quit paying thousands of $$ for ripoff Facebook ads! I can show you a platform that costs only a minute bit of money and creates an almost indefinite amount of web visitors to your website}
Tue Apr 20 2021, 07:00 AM
Wow, awesome blog layout! How long have you ever been blogging for? you make running a blog glance easy. The overall glance of your website is wonderful, let alone the content material! https://1xbet-rabochee-zerkalo.best/ 1xbet рабочее на сегодня прямо сейчас рабочий зеркало 1xbet
Mon Apr 19 2021, 06:46 PM
Great work! That is the kind of info that are supposed to be shared around the net. Disgrace on Google for now not positioning this post higher! Come on over and talk over with my web site . Thanks =) https://1xbet-rabochee-zerkalo.best/ 1xbet рабочее на сегодня прямо 1xbet рабочее на сегодня
Mon Apr 19 2021, 04:30 AM
Hello superb website! Does running a blog similar to this take a lot of work? I've very little expertise in programming but I was hoping to start my own blog soon. Anyhow, if you have any suggestions or tips for new blog owners please share. I understand this is off subject nevertheless I just wanted to ask. Cheers! http://blog.bestwp.live/page.php?sitemap=yellow Williams
Sun Apr 18 2021, 05:31 PM
Brandy Levi
{{Looking for|Want to find|Want to get|Do you need} more {buyers|clients|people ready to buy|customers|serious customers|business} {for your site|for your website|for your website or online store|for your online business}? {We can provide|We can get you|We can deliver} {targeted|keyword targeted} {traffic|visitors|people} {specifically|precisely} {for your business model|for your specific type of business|for your business|for your type of business}



Thu Jun 25 2020, 03:46 PM
Mon Jun 22 2020, 03:03 PM
Tue Jun 16 2020, 05:10 PM
Sat Jun 13 2020, 09:43 PM
Thu May 21 2020, 12:44 PM
Thu May 21 2020, 01:28 AM
Wed May 20 2020, 07:05 PM
Wed May 20 2020, 11:52 AM


Guests: 83, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 38215
Newest member: Mirza123