Digital Connections 101

Rick
5 min readFeb 18, 2023

--

Image from pixabay

Check your definitions (just in case)

almost nobody in class could define these terms so imma put what the professor said here

  • Potential difference: Is a difference (-) of two points a and b. Or simply put Vab = Va — Vb ; that is «[…] the potential of a with respect to b, equals the work done by the electric force when a UNIT charge moves from a to b.» [1] in electric circuits this is often referred as «voltage». Note that a reference is also needed (also called ground).
  • The voltage of a car battery (for example) equals the difference in potential VAB = VA-VB between its positive terminal (point A) and its negative terminal (point b) [1].
  • Electric potential: is the potential energy per unit charge. It’s a scalar and it’s measured in volts(V) [1] It has a defined formula:

r: is the distance from the point charge q to the point at which the

potential is evaluated

q: is the point charge

ε0: is the permittivity of vacuum

V: is the electric potential

Digital Connections 101

  • Pull-down resistors and pull-up resistors
  • Pull-up and pull-down resistors are used to correctly bias the inputs of digital gates to stop them from floating about randomly when there is no input condition [2]. Digital gates are made to work with 0s and 1s at their inputs. However remember that there are some considerations so they can work properly Remember that there’s always a minimum and a maximum low and high input, what that means is that the voltage has to be either high enough to be considered a logical 1 or low enough to be a logical 0
  • Now remember, we always work with a reference and from circuit theory we know that our reference is ground. The minimum high voltage and the maximum low voltage are defined by the manufacturer of the ICs so to figure that out check out the datasheets of the corresponding IC.
  • Now let’s take a look at figure 2, which is a pull-down resistor. Let’s imagine for a moment that it wasn’t connected like it is in the image; considering that the IC is only connected to the supply voltage and that the input is not connected to anything, what would the device read as an input? Some people with little experience working with logic gates might say that the input reads a logical 0 But remember that when we are working with circuits we need a reference or our ground. So the input is reading invalid
  • Now let’s analyze the image as it is and try to figure out what is the voltage of V1 and V2 in the following cases.
  • When the switch is opened:
  • In a pull-down configuration, the input is connected to ground (0V) through a resistor so it would read a logical 0. V1 = +5V; V2 = 0V In the pull up configuration, the logic gate is connected to the positive terminal of the supply voltage(+5 V) through a resistor so it’s a logical 1 (however note that the resistor accounts for a voltage drop so it wouldn’t be 5v at the input but depending on the resistor it can be high enough to trigger a high input). V1 = 0V; V2 = 5V-VR100
  • When the switch is closed:
  • In a pull down configuration, the path of least resistance is from the positive terminal to the input, so the reading is a 1. V1 = 0V; V2 = 0 (there’s no voltage across a jumper wire, theoretically) In a pull up resistor it’s the opposite, so the reading would be a 0.
Figure 2. Pull down resistor
Figure 3. Pull Up resistor

Pro tips (for electronics)

You can code but always know your hardware

Do it on paper following the steps you need to follow

when you have your steps clear proceed to your flow chart and keep going from there

Structured vs Unstructured Language

A structured programming language allows to divide the program into sections or modules, this can make coding easier to read and understand. However, by nature they’re sequential and you can’t always go back to a certain part of the code unless it ́s a function. Assembler is not structured, you can go to any part of the code (e.g, a branch instruction or a jump instruction). there isn’t always a sequential path to make. You can’t do that in c/c++

Transfer of data (just some examples on AVR instruction set)

LDI: It’s an instruction that we’ve seen before in a computer design class. LDI is a load immediate of a constant to a given register Rd (destiny register). For example, LDI R16, 0x0F this line of assembler code means: load the constant 0x0F(15 in Hex) to the register R16.

LDS: works similarly, but the main difference is that we are loading the content of a memory space inside a register. For example, LDS R16, 0X0A doesn’t mean load the value 0X0A(10 in Hex) to the register R16; it means, load the contents of the memory space or memory address 0X0A to the register R16.

References

1. Young, H., Freedman, R. and Ford, A., 2012. University Physics With Modern

Physics. Boston: Pearson education, pp.761–763.

2. Electronics tutorials. Pull-up and Pull down resistors. Available at:

https://www.electronics-tutorials.ws/logic/pull-up-resistor.html

--

--

Rick

I blog about everything I learn, Digital Image Processing, Data Science, IoT, Videogame design and much more :)