EE 472 Embedded Systems Dr Shwetak Patel Computer
EE 472 – Embedded Systems Dr. Shwetak Patel Computer Science & Engineering Electrical Engineering
Agenda n Pulse Width Modulation n Free. RTOS n Midterm review n Lab 3 overview n Drone tutorial Shwetak N. Patel - EE 472 2
Pulse Width Modulation (PWM) n Vary the width of a period pulse n Can control the voltage to a DC motor n I. e. speed control n Use a timer to create the pulse n Duty cycle is the percentage the pulse is on for that period
PWM
Free. RTOS n Open source embedded OS n n freertos. org Features: n Preemptive priority scheduler n Semaphores
Sleep() void Example. Task(void *p) { while( 1 ) { Led_Set. State( 0 ); // turn the LED off Sleep( 900 ); // leave it off for 900 milliseconds Led_Set. State( 1 ); // turn the LED on Sleep( 10 ); // leave it on for 10 milliseconds } } Shwetak N. Patel - EE 472 6
Create tasks void Blink. Task( void* p ); //declare void Run(){ Task. Create( Blink. Task, "Blink", 400, 0, 1 ); //give scheduler the task …. . } void Blink. Task( void* p ) //define the task { Led_Set. State( 1 ); Sleep( 1000 ); … } Shwetak N. Patel - EE 472 7
Task. Create() void* Task. Create (void(task. Code)(void*) , char * name, int stack. Depth, void* parameters, int priority ) Shwetak N. Patel - EE 472 8
Malloc() Dynamic memory allocation Shwetak N. Patel - EE 472 9
Midterm n Closed book, no notes, no cheat sheets n Concepts covered in class n Assigned readings: NP, JKP n Class exercises
Concepts n C programming n what’s the output of some code n write a short function n pointers, arrays n structs n defines n bitwise operators
Concepts (cont. ) n ARM n High level questions only n UML and Structured Design n Know what this is n UML diagrams shown in class
Concepts (cont. ) n Tasks, threads, and interrupts n Scheduling algorithms n Diagramming, analysis, differences
Lab 3 and Drone Tutorial
Questions? Shwetak N. Patel - EE 472 15
- Slides: 15