Download presentation
Presentation is loading. Please wait.
Published byJoshua Harrell Modified over 9 years ago
1
ENTC-489 Embedded Real Time Software Development Embedded Real Time Software Development Week 10 Real Time System Design
2
ENTC-489 Embedded Real Time Software Development Today’s Agenda Real Time Control Diagrams – Circular Queues – Message Queues – Health Monitor – Event Flags Examples
3
ENTC-489 Embedded Real Time Software Development Control Diagrams
4
ENTC-489 Embedded Real Time Software Development Symbols Semaphores & Mutexes Mailboxes and Message Queues
5
ENTC-489 Embedded Real Time Software Development Symbols Timers and Event Flags Tasks and Functions
6
ENTC-489 Embedded Real Time Software Development Symbols Hardware Global Variables
7
ENTC-489 Embedded Real Time Software Development Example 1 – Serial Port
8
ENTC-489 Embedded Real Time Software Development Example 1 – Serial Port Characteristics – Received characters When a character is received it is placed in a circular queue If the queue is full the incoming character is lost Counting semaphore indicates a character has been added to the queue Interface gets_with_pend(), getc_with_pend() – Transmitted characters Characters to be transmitted are placed in a circular queue If there is no room in the queue, the character is dropped Interface functions check for space in buffer, use timer delay before checking again if inadequate space Interface puts_with_pend(), putc_with_pend()
9
ENTC-489 Embedded Real Time Software Development Serial Port Control Diagram
10
ENTC-489 Embedded Real Time Software Development Circular Queues (put) Note: Always leaves on entry empty
11
ENTC-489 Embedded Real Time Software Development Circular Queues (get)
12
ENTC-489 Embedded Real Time Software Development Example 2 - Logger
13
ENTC-489 Embedded Real Time Software Development Example 2 - Logger Logger Characteristics – Tasks send information to be logged via send_sensors_to_log() or send_error_to_log() – Task waits for data to log, then sends to both the serial port and the EEPROM – Messages may come more rapidly than they can be written to the serial port or EEPROM – Most of the time this task does nothing
14
ENTC-489 Embedded Real Time Software Development Logger Control Diagram
15
ENTC-489 Embedded Real Time Software Development Logger Message Queue Operation
16
ENTC-489 Embedded Real Time Software Development Logger Task Flow Chart
17
ENTC-489 Embedded Real Time Software Development EEPROM Operation All Operations times or on the order of 1mS
18
ENTC-489 Embedded Real Time Software Development EEPROM Storage
19
ENTC-489 Embedded Real Time Software Development Example 2 - Health
20
ENTC-489 Embedded Real Time Software Development Health Task Warning/Cautions If you plan to try and restart tasks (as shown today) – If a task allocated memory and you kill the task, that memory is lost forever – If a task created a resource (Semaphores, Message Queues, etc) these will need to be deleted and recreated – In general, it is generally best to do a hardware reset.
21
ENTC-489 Embedded Real Time Software Development Health Task Control Diagram Global Variable Check in Advantages – Supports short watchdog timer values best – Allows tasks to set their own WDT times
22
ENTC-489 Embedded Real Time Software Development Global Variable Check In Flow Chart
23
ENTC-489 Embedded Real Time Software Development Health Task Control Diagram Event Flag Check in Advantages – Health task uses less CPU time
24
ENTC-489 Embedded Real Time Software Development Event Flag Check in Flow Chart
25
ENTC-489 Embedded Real Time Software Development Capstone Example Monitor critical information – Compass – Acceleration – Gyroscope Monitor non-critical information – GPS Position – Battery information (current,voltage,power) SPI Input from controlling device – PWM Values SPI Output to controlling device – Monitored data PWM – Motors – Camera gimble SPI RTS/CTS Functionality
26
ENTC-489 Embedded Real Time Software Development UAV Example Program Serial Port has two modes – SP1 – Sends XY location to serial port every 5 seconds – SP2 – (default) Can receive commands from serial port “Dump” dumps the logged information RGB LED, solid red if Z axis deviates 5 degrees from vertical, otherwise, blinking green Accelerometer – Must be read often (100Hz or faster) to compute current XY and tilt EEPROM Logging – xy position of darkest location and light level – xy position of brightest location and light level – Latest xy position, every 5 seconds – Logging disabled in SP2 – Yellow LED on for 1 second when a higher or lower light level is logged. Switch montioring – Debounce switches – SW1 Clears the XY location and log information and puts unit in SP1 mode – SW2 Puts unit in SP2 mode, stops logging
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.