> Hi, > > Good afternoon. i have several issues that i am in > doubt. > > 1. what is embedded system? what is the difference > between a normal electronic system with a uC, with an > embedded system? Here's a definition of embedded system: http://www.mitre.org/research/y2k/faq/embedded.html#1 > 2. i am used to programming pic16F84 and 68hc11. the > procedure is like this. key in the assembly in an > editor, them assemble them to hex file, then download > them to the uC. that's it. the uC can be brought > everywhere and still function the same. > > My question is, why people are telling me that i need > a RTOS ( Real Time Operating System ) to develop an > embedded system? They are telling me that drivers need > to be written, so on and so forth. Why? > What role does the RTOS play? What you have been programming all along is what's call the "foreground/background" or "superloop" system. That is, an application in an infinite loop calling different modules/functions to perform a desired operation in the "background" Occasionally it is "interrupt"ed to perform some critical task in the "foreground". These are your interrupt subroutines. This system works fine for most application. Biggest drawback is that modules/functions in the "superloop" does not get it's share of CPU time at a constant rate, or to put in RTOS-speak, it is in a non-deterministic manner. The rate that your function gets executed depends on the time taken by other modules/function calls in the loop. This becomes a problem when your "background" system or "superloop" gets increasingly complicated with more and more modules. When system that previously works fine, but no longer works when new code is added to the "superloop". How then can you ensure that a function IS executed, say every 10 millisecond. Task/function response time will be "non-deterministic" in your current system, because you have to go thru the all modules in the "superloop" before it gets to your function. Best example is a system where you enter a key, but sometimes, nothing happens until a certain time later. Sometime fast, sometime slow. This is one side-effect of non-deterministic system. You probably can use a timer interrupt to perform this task. But what if you have more and more functions that need to be executed every, say 5ms, 50ms, 1s, 1 hour, 1 day etc. This is where a RTOS comes in. With an RTOS, every task/module/function is given a share of CPU time at a predetermined rate and prioritized according to a predetermined task priority. This ensures that the highest priority task gets executed as quick as possible by the CPU and thus improves and optimises overall system responsiveness. This means that a task that is just waiting for an event (such as keypress) can give up CPU time to other more important task, instead of hogging CPU time in a polling loop. > i don't get it, cause i am still looking things at the > binary level. You will, once you start working on bigger and more complex systems, when even assembly coding will no longer do. You'll most probably need to move on to higher-level language such as C. > 3. Another issue is the driver issue. When someone > told me that driver need to be written for certain > embedded component, i start to go blank. how should i > start? > Another senior engineer told me that i have actually > been writing drivers without knowing it. really? A driver is just a piece of code that you write to make certain piece of harware function. Say you have an external EEPROM, the code you write to interface with that EEPROM is the driver. > > Can anyone please enlighten me? > > thanks a lot > Hope the explanation helps. If you want to learn about RTOS, a good book is "MicroC/OS-II, The Real-Time Kernel" by Jean Labrosse. www.micrium.com Highly recommended and I'm in no way connected to Jean Labrosse or Micrium ;-) Regards, Peter Tiang -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu