Microprocessor Merge
Microprocessor Merge
Lecture 3
Microcontroller Architecture
The Harvard Architecture
• Timers - These internal circuits of the MCU provide precision binary timing
• Watchdog timer -
• Counters – precision counting
• ADC and DAC: This stands for
• UART – this is used for RS232 communication
• SPI controller – this is used for serial communication using the SPI
protocol
• USB controller – what does this do?
• PWM generator – generates PWM
• Flash Memory
• Low power management units – e.g. Sleep/Wake up
• Others – e.g Digital Audio Interfaces (built on top)
• In many processors, especially microcontrollers a single pin will be used
for many purpose depending on the state of its control register.
Sample PIN layout on a PIC18F2455
Interrupts and Polling
• Consider a scenario in a lecture room.
• During this lecture, I can accept questions from Peter as I
speak (and thus allow to be interrupted) or I can stop
talking and ask Peter if he has a question (whether or not
his hand is up).
• The device identifier can be as simple as an index in an array called the interrupt
vector table, which contains the memory addresses of the ISR to be executed
when an IR is received. These memory addresses are called interrupt vectors.
main()
{
//code here
}
ISR1() //this code is stored in an address
{
}
ISR2() //this code is stored in an address
{
}
• Non vectored interrupts are also known as polled interrupts which
require that the interrupt handler poll or send a signal to each device
in turn in order to find out which one sent the interrupt request.
• Please note, this is different from polling though the word is used in
the same manner.
Output: 4+5=9
The C language
Other high-level languages do require a small amount
of awareness by the program-author of how a
computation is going to be processed
For example, that:
- the main program will get “linked” with a
“library” of other special-purpose subroutines
- instructions and data will get placed into
separate sections of the machine’s memory
- variables and constants get treated differently
- data items have specific space requirements
Same example: rewritten in C
It means: z = x + y;
Simplified Block Diagram
Central
Main
Processing
Memory
Unit
system bus
Mnemonic (Opcode)
Operand
Comment (optional)
Label Field
Mnemonic Field
Operand Field
Operand Field (cont’d)
Comment Field