1 / 6

Project 4 – Multi-Rate

Project 4 – Multi-Rate. So, what’s new?!?! Similar set of tasks Will need to add Timer 1 configuration for 1 ms period to system_init () decode_buttons () will need to calculate a step_delay to achieve proper speed main() will check two SW counters for when to read buttons or take a step

Download Presentation

Project 4 – Multi-Rate

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Project 4 – Multi-Rate • So, what’s new?!?! Similar set of tasks • Will need to add Timer 1 configuration for 1 ms period to system_init() • decode_buttons() will need to calculate a step_delay to achieve proper speed • main() will check two SW counters for when to read buttons or take a step • Delay routine will poll T1IF until 1 ms expires, then decrement SW counters and toggle LED

  2. Project Task List

  3. Task Manager – While(1) • Checks button_delay counter. If zero, it calls read_buttons and decode_buttons, toggles LEDB, and resets the counter. • Checks step_delay counter. If zero, it calls the FSM and motor output functions, toggles LEDC, and resets the counter. Reset value will depend upon current step_delay value. • Calls Timer1_Delay

  4. Timer1_delay() tasks

  5. LED Behavior • LEDA toggles once per ms (2 ms period!) • LEDB toggles when buttons are read (100 ms) • LEDC toggles every step (speed/mode dependent based on buttons) “Some” flexibility on where certain LED toggle in the software. 

  6. Gotcha! • Two errors can lead to a task not executing • Avoid decrementing the counter past zero before the task manager detects it • Avoid resetting the counter before the task is performed

More Related