Embedded Systems Design
Program Flows
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2325046/images/10363148/ezgif.com-gif-maker.gif)
Program Flows
-
Pooling
-
Interrupt Driven
Combination
Handling Concurrency
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2325046/images/10363153/pasted-from-clipboard.png)
-
RTOS
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2325046/images/10363164/pasted-from-clipboard.png)
Pooling
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2325046/images/10363154/pasted-from-clipboard.png)
Basic Structure
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2325046/images/10363169/pasted-from-clipboard.png)
void Setup()
{
// Initialization code goes here
}
void Loop()
{
// Your code goes here
}
Pooling
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2325046/images/10363169/pasted-from-clipboard.png)
void Setup()
{
// Initialization code goes here
Initialization();
}
void Loop()
{
// Your code goes here
if(Peripheral_A)
{
ProcessA();
}
if(Peripheral_B)
{
ProcessB();
}
if(Peripheral_C)
{
ProcessC();
}
}
Interrupt Driven
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2325046/images/10363157/pasted-from-clipboard.png)
Basic Structure
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2325046/images/10363169/pasted-from-clipboard.png)
void Setup()
{
// Initialization code goes here
}
void Loop()
{
// Your code goes here
}
Interrupt Driven
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2325046/images/10363169/pasted-from-clipboard.png)
void Setup()
{
// Initialization code goes here
Initialization();
}
void Loop()
{
// Empty. Things are done in Interrupts
}
void ISR(Routine_A)
{
ProcessA();
}
void ISR(Routine_B)
{
ProcessB();
}
void ISR(Routine_C)
{
ProcessC();
}
Combination
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2325046/images/10363159/pasted-from-clipboard.png)
Basic Structure
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2325046/images/10363169/pasted-from-clipboard.png)
void Setup()
{
// Initialization code goes here
}
void Loop()
{
// Your code goes here
}
Combination
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2325046/images/10363169/pasted-from-clipboard.png)
volatile char isr_flag_a = 0;
void Setup()
{
// Initialization code goes here
Initialization();
}
void Loop()
{
// Your code goes here
if(isr_flag_a == 1)
{
isr_flag_a = 0; // Clear Flag
Process_A();
}
}
void ISR(Routine_A)
{
isr_flag_a = 1;
}
RTOS
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2325046/images/10363182/pasted-from-clipboard.png)
Basic Structure
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2325046/images/10363169/pasted-from-clipboard.png)
void Setup()
{
// Initialization code goes here
}
void Loop()
{
// Your code goes here
}
RTOS
![](https://s3.amazonaws.com/media-p.slid.es/uploads/2325046/images/10363169/pasted-from-clipboard.png)
#include <Arduino_FreeRTOS.h>
/* Additional Variables will be declared here... */
void Setup()
{
// Initialization code goes here
xTaskCreate(Task_A); // Note: abstract representation
}
void Loop()
{
// Empty. Things are done in Tasks
}
void Task_A()
{
// your code goes here...
}