??? 12/08/05 11:21 Read: times Msg Score: +1 +1 Good Answer/Helpful |
#104871 - Horses for Courses Responding to: ???'s previous message |
I think Erik's concept of 'real-time' is flawed. There's no doubt that using a pre-emptive RTOS may affect interrupt response time, but by the same token, using a co-operative system (or no 'system' at all) there are times where interrupts are disabled so that certain operations can be atomic. To do anything useful, interrupt code must share variables with non-interrupt code so therefore we need atomic operations which imply we need to disable interrupts (especially on a '51). There's no argument that a RTOS adds extra baggage - as long as the person using it understands the limitations. As such, using a RTOS is not inherently bad on a 8051 (or any other cpu) but personally I would probably not choose to use a RTOS on a '51 - I would choose another ,hopefully, more suitable cpu. Erik's premise seems to be you can't waste those precious cpu cycles - I get worried if I'm working on something that is so critically tuned that every cycle is make or break. My first 8051 project was to investigate the advantages of using a 8051 instead of a 4MHz Z80 for reception of DMX512. I had it working on a Z80 -just. I was counting every last cycle and it just worked. I even had to do hardware tricks to get the SIO chip to receive 250Kbit/s - I needed a 4MHz baud rate clock but there was a limit on the baud rate clock vs the cpu clock. I could have used an 8MHz part - but that would introduce the problem of using a high speed (at that time) eprom. Nevertheless the product worked. I converted it over to a 16MHz 8051 and had heaps of time in comparison and I didn't need an expensive eprom. From that point I converted over to 8051. One could say the 'real time' requirements were better served by the 8051 solution although one could say I was a hero coaxing the Z80 to do the same job. My customers knew no difference. Ultimately, what cpu you use, at what clock rate, whether you use C or assembler and whether you use spaghetti code, a RTOS or some form of co-operative tasking all depends on the person that has to make it all work. If that person understands the strengths/weeknesses of the various options, he/she should be able to make a good judgement and have a successful project. This is engineering. |