Electronics (and programming) Math



  • This is just a basic run-down on some simple math that can be used in electronics and some in programming. I even tried to hit on some basic formulas such as Ohm's Law, The Power Formula, Resistors, Capacitors in series and parallel. I am NOT and engineer, but I do understand the basics to show here. The stuff here may or may not be useful, if you understand how memory addresses and such work, then the HEX will be useful, I think. The binary is just interesting to me, so I felt it was justified to talk about it and explain the basics.


  • Binary


    Binary
    Base 2 212 211 210 29 28 27 26 25 24 23 22 21 20
    Decimal4069204810245122561286432168421

  • Above is a small table showing the first 12 number places in binary and their decimal counterparts. Binary is set in Base 2, which just means 2 to the power set.


  • Example: 25 = 32


    or


    2 * 2 * 2 * 2 * 2 = 32


  • When converting a number from decimal to binary, you start with the largest power of 2 that can be taken from the decimal number with out going in to a negative figure.


  • When a power is taken out of a decimal number, that place is given a 1. If a power has been skipped over, the place is given a 0.


  • Let's use 536 as a example number. 536 in decimal.


  • When we look at the above chart we can see that 512 is the largest power of 2 that can be taken out of 536.


  • So. 536 - 512 = 24 and the 512 power is given a 1


  • The 256, 128, 64 and 32 powers are each given a 0


  • Now we have 24 left, the next power is 16.


  • So. 24 - 16 = 8 and the 16 power is given a 1


  • We are now left with 8 which is the 23 power space.


  • So. 8 - 8 = 0 and the 8 power is given a 1


  • The rest of the power places are given 0's


  • I the end we have, 1000011000 = 536


  • Binary
    Base 2 212 211 210 29 28 27 26 25 24 23 22 21 20
    Decimal4069204810245122561286432168421
    Binary0001000011000

  • This table better shows the placement of the 1's and 0's for the decimal number of 536. The reverse prcess can be peformed to convert from binary to decimal. Take all numbers places with 1's and add them together to get a decimal form from the binary number.


  • Hex-Decimal


    Here is a table of the HEX numbers to get started
    HEX
    1=1
    22
    33
    44
    55
    66
    77
    88
    99
    A10
    B11
    C12
    D13
    E14
    F15

  • First start with a decimal number - 175


  • We need to convert 175 to binary


  • 175 = 10101111


  • We now take the binary version and group the 1's and 0's into groups of 4's.


  • These groups are now considered 2 seperate numbers in binary. 1010 and 1111. 1010 now equals 10 and 1111 equals 15. 10 in HEX is A (refer to table above) and 15 in HEX is F (refer to table above).


  • The number 175 is now found to be equal to AF in HEX.


  • Sometimes the number is binary does not have enough 1's and 0's to make even groups of 4's. Such as the number 701 = 1010111101

  • We have the groups, starting from the right, 1101, 1011 and then you have 10. You take the 10 and add 0's to the front to make a group of 4 such as 0010.

  • Now we have 0010, 1011 and 1101.


  • 0010 = 2 = 2 in HEX


    1011 = 11 = B in HEX


    1101 = 13 = E in HEX


  • So, 701 equals 2BE in HEX


  • Octal Numbers


  • Octals are much like HEX. An octal number is created by taking a decimal number converting it to binary and then you group the 1's and 0's into groups of 3's.


  • Octal
    000 = 0
    001 1
    010 2
    011 3
    100 4
    101 5
    110 6
    111 7

  • Start with 315.

  • 315 = 100111011


  • With 315 converted to binary, group the 1's and 0's into groups of 3's. The same rules apply with octals as HEX. If there are not enough to make even groups of 3, then the same rule still applies, add leading 0's untill the group has been made into 3.


  • 315 = 473 in octal

  • Ohm's Law



  • The Ohm's Law Chart above visually shows how the formula works.

  • It's as simple as:
    To find Voltage (E):E = I x RorVoltage = Amps x Resistance
    To find Amps (I):I = E / RorAmps = Voltage / Resistance
    To find Resistance (R):R = E / IorResistance = Voltage / Amps

    Power Formula



  • The Power Law Chart above visually shows how the formula works.

  • It's as simple as:
    To find Power (P):P = I x EorWatts = Amps x Voltage
    To find Amps (I):I = P / EorAmps = Watts / Voltage
    To find Voltage (E):E = P / IorVoltage = Watts / Amps

    Resistors


    Series Parallel

    Capacitors


    Series Parallel