ECE 340 FAQ

 

Digital Logic

Decoder

A decoder takes a binary string as input and activates exactly one output. For example, a 2-to-4 decoder has a 2-bit input and activates one of four outputs. (sometimes called a 1-hot code)

Multiplexer

A multiplexer selects one of 2n data inputs based upon an n-bit control input. Each data inputs may consist of m bits. e.g., An 8-bit, 4 to 1 multiplexer.

Registers

In the simplest case, just a collection of bits, like a group of flip-flops.

Tristate Driver

A buffer capable of producing three output "values" or "states": 0, 1, or Z. Used primarily for bi-directional I/O.

Push-pull (totem pole) versus Open drain outputs

Push-pull outputs can actively drive an output to Vdd or GND by sourcing or sinking current. Open drain outputs are missing the connection to VDD, resulting in a high-impedance condition for outputs of logic one. Used for shared conductors.

Schmitt Trigger (input)

An input with two switching thresholds to reduce noise propagation.

Hexadecimal

An alternative to decimal and binary representation that makes it "easy" to specify binary patterns for isolating bit positions in a group.

 

Programming

Define statement

A "define" statement is used for text substitution by the compiler preprocessor. Used to localize "magic" numbers for code reuse/readability. Not an executable statement. Warning: never terminate with a semicolon!!!

Pragma statement

A "pragma" is an implementation-specific compiler "directive". Basically, information about the hardware that the compiler uses when compiling the program. It is not an executable part of the program.

I/O Read/Write on the PIC32

See Ch. 12 of the data sheet. Use dedicated CLR, SET, and INV registers for bit-twiddling.

Masking

A method of using a binary pattern and bit-wise logical operators to isolate a specific bit, or group of bits, in a larger group. Used for setting, clearing, etc.

Microchip MPLAB IDE

See on-line documentation for specifics.

Byte

Eight binary digits (i.e., bits) equal a byte, so four equal a nibble. A "word" is two or more bytes, depending upon the width of the CPU data bus.

Real-Time Computing (RTC)

A computing environment in which there are time deadlines for completing tasks. Not to be confused with a Real-Time Clock (RTC), which keeps track of date and time.

Assembly Language

Native programming language of the CPU, as opposed to a high-level language like C. Typically generated by compiling a HLL.

Machine Code

The ones and zeroes that represent the instructions and data to be used by the CPU. Produced by an assembler.

Variable Scope/Visibility:

Global versus Local

Variables are limited in scope to the functions in which they are declared. Variables declared outside of a function are global variables and visible to all functions.

Storage Class: Static versus Auto

Auto variables (the default) do not retain their value between function calls, (e.g., when the function is reentered), whereas static variables do. To accomplish this, the compiler statically allocates storage space at compile time for static variables.

Function versus Macro

A macro is simply a concise mechanism for including in-line code. There is no overhead as there is with a function call and return, multiple macro invocations can lead to larger code size.

Pointer

A variable, the value of which is a memory address of some other variable.

Pass by Value versus Pass by Reference

By definition, arguments to C functions are passed by value, meaning the function receives a "copy" of the data. Any changes to that data are not applied to the original variable of the calling function. If the data changes do need to be applied, you can pass the function a pointer (i.e., the location where the variable is stored). This is called passing by reference.

Real-Time Operating System (RTOS)

An operating system which supports scheduling of multiple tasks for RTC.

Polling

A software mechanism by which the CPU checks on the status of an I/O device in order to detect a need of service.

Interrupt/exception

An event that alters program flow. Can be internal, external, or software generated. Used to notify a CPU of a service request.

Interrupt Service Routine (ISR)

A special subroutine that is "invoked" (as opposed to "called") when a specific interrupt is generated, usually by hardware. Can only communicate with other software entities through global variables.

 

Computer Organization

Address Bus

A collection of wires that go from the CPU to one or more memory chips and carry information (i.e., an address) for accessing a specific memory location.

Address decoding

Usually there are multiple memory chips "watching" the address bus. A separate decoder is used to decode a limited set of address lines and activate a specific chip. For example, if you had four memory chips of equal size, you could use the two most significant bits of the address bus to identify which chip should respond.

Registers

Small, on-chip storage for holding data manipulated by the CPU. Typically accessed by name, rather than address.

Memory

Very large, off-chip storage for programs and data. Can only be accessed by forming an address.

Program Counter (PC)

A counter that points to the next instruction to be fetched from program memory.

Stack Pointer (SP)

A counter that points to the top of the stack.

Stack versus Heap

The Stack is a section of memory used for temporary storage. Can be used for function arguments or local variables. Stack size can grow or shrink as items are written (pushed) or removed (popped). The Heap (if used) is a section of dynamic memory requested by a program at run-time (as opposed to static allocation at compile-time). The Heap grows towards the stack and failure to release (i.e. deallocate) memory is referred to as a "memory leak" and can cause a program to run out of memory and crash.

Memory-mapped I/O

I/O peripherals share the address bus with memory chips and must decode the address in order to recognize access.

Dedicated I/O

I/O peripherals accessed using special I/O instructions. Limits the number of address lines that need to be decoded. Allows for access using a separate bus.

EEPROM, Flash, or NVRAM

Examples of non-volatile memory that retain stored information when power is removed.

Instruction Set Architecture

Programmers "view" of a processor. How many registers? How wide is the data bus? What types of instructions are supported? How are memory addresses formed?

Addressing Modes

Different ways of combining register contents and program constants to form a memory address.

ALU

Arithmetic Logic Unit. Used by the CPU (Central Processing Unit) to execute arithmetic and logical operations.

 

Other Peripherals Used to Reduce CPU Load

Inter-Integrated Cicuit (I2C) Interface

A two-wire serial bus protocol

Serial Peripheral Interface (SPI)

A four-wire serial bus protocol

Pulse Width Modulation (PWM)

Varying the duty cycle of a waveform to control level of "activation", e.g., motor speed or light intensity.

Analog to Digital Converter (ADC or A/D)

Separate circuitry (on or off-chip) which samples an analog input and produces a binary representation.

Digital to Analog Converter (DAC)

Generates an analog voltage from a binary pattern.

UART

Universal Asynchronous Receiver Transmitter. Circuitry for bi-directional, serial communication, e.g., RS-232.

Timers

Used to control timing of input sampling, output events, or anything else that needs to occur at a specific rate.