130 likes | 149 Views
BASIC DESIGN USING REAL TIME OPERATING SYSTEMS. OVERVIEW PRINCIPLES EXAMPLES ENCAPSULATION OF SEMAPHORES AND QUEUES HARD REAL-TIME SCHEDULING CONSIDERATIONS SAVING MEMORY SPACE SAVING POWER. Response to status requests sent to network hardware. Interrupt Routine.
E N D
OVERVIEW PRINCIPLES EXAMPLES ENCAPSULATION OF SEMAPHORES AND QUEUES HARD REAL-TIME SCHEDULING CONSIDERATIONS SAVING MEMORY SPACE SAVING POWER
Response to status requests sent to network hardware Interrupt Routine Message passed through RTOS Other tasks activity Received frames DDP Protocol Task Frames that are not addressed to telegraph are discarded. Interrupt Routines receives serial data Frames addressed to telegraph Response to status requests ADSP Protocol Task determines if frame is print data Print data sent to serial port. Receive data New stats Serial port Task determines if serial data contains new status Print data
WRITE SHORT INTERRUPT ROUTINES The system must respond to commands that are coming from a serial port. Commands always end with a carriage return Commands arrive one at a time the next command will not arrive until the first command finishes. The serial port hardware can only receive and store only one character at a time and characters may arrive quickly. The system can respond to commands relatively slowly.
HOW MANY TASKS With more tasks you have better control of relative responses. If more tasks are there they can be given priorities and they run on priority basis. With more tasks the system can be modular. With more tasks the system can encapsulate data more effectively. With more tasks obviously more data is shared among the tasks. With more tasks more likely to have passes messages and shared data. Each task requires stack, therefore for more tasks more memory required for stack.
Each time mp switches between tasks certain amount of time evaporates in saving the context of the task an so on. More tasks means more calls to RTOS.
A SEMAPHORE TASK HELPS CONTROL SHARED HARDWARE Paper handling task Display task makes decisions about what to display Button handling task PRINTER MELTDOWN
Tank monitoring system Alarm & bell Floats and thermometers in a tank
TASK MONITORING DESIGN Float interrupt routine Legend: Solid line: Message passed through RTOS Dotted line : Other task activity Timer interrupt routine Float levels Float reading module Buttons Float levels Requests Level calculation task Over flow detection task Warnings Button interrupt routine Gasoline level data module Warnings Button command task Display task Prompts Printer interrupt routine Printer formatting task Hardware Displays Task – 2 is leaking!!
Hard real Time Scheduling Considerations Hard real time systems it is important to write subroutines that always execute in the same amount of time or that have a clearly identifiable worst case. Fixed sized buffers whose allocation routine runs in the same amount of time. Tasks that avoid semaphores for data protection are preferable since their worst case performance did not depend on the characteristics of the every other task that uses the semaphore.
SAVING MEMEORY SPACE Make Sure That no two functions does the same task. Eg. Memcopy and memmove functions Find out from the results which of the functions are quite frequently are in use and retain those functions and use the same function to the other related tasks so that memory space can be saved. Check that your development tools are not sabotaging you. Configure your RTOS to contain only those functions that you need. Look at the assembly language instructions that are created by the cross compiler to see if certain of your C statements translate into huge numbers of instructions.
SAVING POWER Embedded systems run on battery in order to preserve the battery it is customary to turn of the power for the modules which are not in function. common method to turnoff the power is to use timer circuits. Another method is to turn of the microprocessor in executing the instructions but on boar terminals continue to operate. We use interrupt mechanism to turn on the microprocessor in order to resume the task. Another method is to turn of the entire system and when ever it is needed turn on the system so that power can be saved.