1 / 3

Task Manager

Task Manager. “main” – the task control function responsible for calling the support functions listed below. “ system_init ” – initializes all PIC32MX7 hardware as follows Sets Port G to read the state of BTN1 and BTN2 Sets Port B to output only bits 2, 3, 4, 7, 8, 9,and 10

swann
Télécharger la présentation

Task Manager

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. Task Manager • “main” – the task control function responsible for calling the support functions listed below. • “system_init” – initializes all PIC32MX7 hardware as follows • Sets Port G to read the state of BTN1 and BTN2 • Sets Port B to output only bits 2, 3, 4, 7, 8, 9,and 10 • ConfigureTimer 1 to set the interrupt flag once each millisecond • Implements a while(1) loop that does the following • Waits for the button_delay counter variable to be zero. When it is zero, it calls the functions described in “2” and “3” and resets the counter. • Waits for the step_delay counter variable to be zero. When it is zero, it calls the functions described in “4” and “5” and resets the counter. • Implements a ms delay using “6”.

  2. Tasks • “read_buttons” – reads the status of BTN1 and BTN2 • “decode_buttons” – determines the values of step_direction, step_mode, and step_delay using the rules specified in Table 2. • “stepper_state_machine” – determines the new output code for the stepper motor • “output_to_stepper_motor” – sends the four bit code to the stepper motor • “Timer1_delay” - Waits 1 ms, toggles LEDA, decrements task counters

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

More Related