Posted on Leave a comment

How to calculate the value of a resistor from colour codes

To calculate the value of a resistor from colour codes.

Then, First, you have to locate the Tolerance band.
The tolerance band mostly in most of the resistors is made from either gold colour or silver colour.

Then you need to look at the next band which tells you the multiplier.

Then you need to look at the opposite end of the resistor and note down the colour in order till the multiplier.

The first band from the left gives us the first digit.
The next band gives the next digit.

Resistor color coding chart
Posted on Leave a comment

Resistor

A resistor is an electronic component that offers resistance in the flow of current. The practical resistor has a slight shift in its values from the ideal counterparts.

Not all the values of the resistor are available in the market. There is a certain number that is chosen and is readily available. If a particular value is to be achieved then a combination made from the selected resistors is to be used.

An ideal resistor follows Ohm’s law.

A practical resistor changes its value if the surrounding temperature, pressure and changes in mechanical dimension etc. Though there are very nominal changes yet they differentiate the ideal resistor from the practical counterpart.

The resistors value is generally marked on the surface. If the resistor is big, standard values along with manufacturing company seal are also printed on top of it.

For very small resistors; either colour bands or some code is written on top of it. As the size goes on decreasing the surface area becomes small and reaches a point where it is not feasible to print anything that can be visible to the naked eye. Then the values are written beside the component.

10 Kilo Ohm Through Hole Type Resistor
SMD Resistor with value code written on it
SMD resistor with a reference to value is printed beside it.

There are two types of resistors.

  1. Fixed Value resitors
  2. Variable Value Resistors

It is important to consider the power dissipation of a resistor. Since resistor obstructs the flow of current. The obstruction causes a buildup of energy which needs to dissipate. If this energy is not released then it will burn the resistor or permanently change its resistance values. So resistors use heat to dissipate the energy.

for example:
Let’s consider an 8-ohm resistor that resists the flow of current.


A voltage source of 9V has connected across. The 8-ohm resistor drops the voltage from 8V to 0V. Blocking a significant portion of voltage that is 8V.
and Let’s say the current flowing in the circuit is one Ampere.
So the resistor needs to dissipate 8W of energy.
Now you need to select a resistor that can dissipate more than 8W of energy. and the next best option is to use a resistor of 10 watts.

Posted on Leave a comment

How to add a new .h header file in STM32 Cube IDE

  1. Click on [arrow] besides Core in your project explorer
  2. Right Click on “Inc” folder and point your mouse at the “NEW” menu item.
  3. Select “header file” option
  4. A new Header file dialog box will appear
  5. Fill in the name of the header file in “Header file” with a dot h extension
  6. Click on finish
  7. Now open your main.c file and add your custom header file after USER CODE BEGIN Incudes
Posted on Leave a comment

STM32L476vg ARM Cortex M4F Architecture

It uses ARM v7E-M architecture.

It a Harvard based architecture with two distinct buses for data and memory.

It has all the instruction set of M0, M1 and M3 .

It also has an additional feature set to support Floating-point Arithmetic. IEEE754 standard in single precision and double precision.

The following points are from the programming model.

There are three modes of operations:

  1. Thumb State
    1. Thread mode: Privileged
    2. Thread mode: Unprivileged
  2. Debug mode

Two thread mode are given to support a operating system. Kernel software run in priviledged mode and the user application software runs in unprivledged mode.

Unprivileged mode has some restriction on memory access.

Privileged mode has full access to system resources.

If an operating system is running and a user application needs to access the Privileged resources it has to generate an exception/interrupt and then the interrupt will be taken by the handler and put the system in privilege mode.

You can switch from privilege mode to unprivileged mode by setting nPRIV and SPSEL bit in the CONTROL register.

Just like all the other processors ARM Cotex M4 has registers and pointer registers.

The major difference is the use of two different stack pointer registers.

  1. Main Stack Pointer (MSP)
  2. Process Stack Pointer (PSP)

If application is running in privileged mode than main stack pointer will be used. And if the application is working in unprivileged the process stack pointer will be used.

General Purpose Registers:

R0 – R12 – General Purpose Register

R13 – Stack Pointer (SP) {MSP and PSP}

R14 – Link Register (LR)

R15 – program counter (PC)

Special registers:

  • xPSR – {APSR, EPSR, IPSR}
  • FAULTMASK
  • BASEPERI
  • PRIMASK
  • CONTROL
floating point registers of arm cortex m4f

There are 32 FPU registers from s0 to s31.

They group together to form a single 64-bit register. which are from D0 to D15

There is a Floating Point Status and Control Register (FPSCR).

Posted on Leave a comment

ARM Processor Based Microcontrollers from ST

There are lot of ARM based microcontroller offered by ST.

They use ARM Cortex M processor with ST peripheral such as GPIO, ADC etc.

They mostly fall into these following groups:

  1. ARM Cortex M0
  2. ARM Cortex M3
  3. ARM Cortex M4
  4. ARM Cortex M33
  5. ARM Cortex M7
    which is also known as M4F as it has an FPU unit.

Then there is ST classification :

  • High performance
    Higher clock speed, Has almost everything included from that segment.
  • Mainstream
    Balanced between Low Power and High Performance.
  • Low Power
    Clock speed reduced to a limit, Has additional hardware for switching off individual peripherals.
  • Wireless
    Has cortex M0+, Peripherals support for radio

The widely available stm32f1 microcontroller also known as the blue pill has ARM cortex M3.

STM32L4 has an ARM Cortex M4F.