Escolar Documentos
Profissional Documentos
Cultura Documentos
Microcontroller
Firmware Development
David Benjamin
Overview
Traditional microcontroller firmware
Polling
Interrupts
Polling
Polling is when a process continually
Polling Example
void main ( void )
{
while(1)
{
while (!button1_pressed);
turn_on_led;
while (!button1_pressed);
turn_off_led;
}
}
Interrupts
Interrupt as defined by Merriam Webster
Interrupt
Interrupt Vector
Interrupts
Why should one use interrupts?
Interrupts
Interrupts are often prioritized within the system and are
disabled.
Globally
Individually
Those interrupts that cannot be disabled are called NonMaskable Interrupts (NMI).
Interrupts
PC = 0x0FE0
0x08A2
0x8A3
XXX
0x08A3
SR = 0x7E
0xFE
XXX
0xFE
STACK
Main()
{
some code
turn_on_led1;
turn_off_led1;
}
__interrupt void port1_ISR(void)
{
disable_interrupts
...
reti
}
0x08A2
0x08A3
0x0FE0
microcontroller.
firmware.
Real-time Operating
Systems
Task
Task Manager
Collection of Tasks
Single Task
A function
voididleState(void);
Time sharing
}
voidwork(void)
{
doTask(RecieveMsg);
doTask(Process);
doTask(TransmittResponse);
}
__interruptvoidTimer_A(void)
{
wakeUp();
}
Example Implementation
Application
Sending a packet
Protocol
Application
Radio Operation Layer
CC1100 HAL
Application
Demonstration
Questions?