3. Programming (1) Flashcards
What is a computer program?
A program is a sequence of instructions (‘code’) to be executed by a computer. It may be organised in different ways (procedures, objects) and written in different languages. The processor executes instructions one after the other unless there is an explicit ‘branch’, ‘jump’ or ‘goto’ instruction.
How are pushbuttons (with internal pullup resistors and LEDs connected to the mC?
Pushbuttons with internal pullup resistors on pin 12, active low. LEDs on pin 13, active high. DRAW DIAGRAM.
What is machine code?
By the time a program is stored (‘burned’) in the program memory of a mC, it is just binary data (1’s and 0’s). It has a particular meaning to the mC and is called machine called.
What is assembly language?
This is just words that can be translated directly into machine code.
Does a programmer ever use assembly language?
Sometimes for critical parts of a program
How is assembly language translated into machine code?
using an assembler.
What is better than an assembler?
A compiler , which does a more thorough job and translates for a higher level language, such as C.
What can the processor do?
- Arithmetic
- Logical
- Bit operations
- Functions (subroutines)
- move data
- Control Flow
- Misc.
What arithmetic can the processor do?
Add, subtract, increment, decrement, divide, multiply; all of these can be floating point or integer
What logical operations can the processor do?
and, inclusive-or, exclusive-or, complement, rotate (shift)
What bit operations can the processor do?
set or clear individual bits in any memory location
What can the processor do with functions (subroutines)?
call and return
What can the processor do to move data?
move data from any memory location to another
What can the processor do to control flow?
If, then, else construction, loops, call functions
What are the misc things a processor can do?
sleep, set and service interrupts, clear WDT - these are usually accomplished by setting/ clearing data in specific registers, and C can be used for this.