At the time of writing this article ARM-based microcontroller means the microcontroller which uses a 32-bit RISC processor design from ARM holdings.
Presently ARM Cortex-M series of processor cores are being integrated into microcontrollers.
The ARM-Cortex M family comprises the following processors.
Cortex-M0
Cortex-M0+
Cortex-M1
Cortex-M3
Cortex-M4
Cortex-M7
Cortex-M23
Cortex-M33
Cortex-M35P
Cortex-M55
The Cortex-M4 / M7 / M33 / M35P / M55 cores also have a hardware-based floating-point unit. The addition of a Floating point unit adds the capabilities for digital signal processing.
To see a list of ARM-based microcontrollers.
Keil.com has a great list that has almost all the major microcontrollers out in the market and is supported by the Keil IDE.
I have recorded a video showing the steps to compile AVR code.
In this video, you will see how to compile AVR led blinking code for the atmega32 microcontroller is being compiled using AVR-GCC in raspberry pi 3 b+.
Step 1. : Create a file and put your avr c code in that file. Save that file with a “.c” extension
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.
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.
There are two types of resistors.
Fixed Value resitors
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.
Now to perform Fourier transform on this sequence.
Here X(k) is the DFT of x(n)
‘k’ is the index representing individual frequency component
‘N’ is the Length of the sample sequence
‘n’ is an index of the element of the sequence in x(n)
For example: if we calculate the value for k =1
This will give us the X(1)
So, if the sequence is sampled at 4Hz and the sampling frequency is equal to two times the max frequency. Then X(1) gives us the 1 Hz frequency component.
To calculate Euler identity
Here is the code:
/*
* Author: ABHAY KANT
* Discrete Fourier Transform using STM32L476vg on STM32L476g-Disco board.
* computes N point DFT
* computes magnitude of N/2 Points of dft
* computes phase of N/2 points of dft
* NOTE: DFT array is named xfft. It DOES NOT Calcultes DFT using FFT algo.
* Limitations: for a 2000 point sequence it takes a lot of time.
And as the number of points increase the computational time also increases.
a rough estimate of time for a 2000 point dft it takes roughly ~ 60 seconds.
*/
asm("nop");
//int xn[6] = {1,1,2,2,3,3};
int16_t Len = 1024;
float xn[Len];
float xfft[Len * 2];
/*
* calculating phase and mag for only N/2 since the value generated after N/2 are conjugate
*/
float phase[Len/2], mag[Len/2];
int k = 1;
int N = 0;
int n = 0;
float real = 0;
float imag = 0;
float param = 0;
int freq = 10;
int i;
/*
* These two "for loops" are used to initalize the array with zero's
*/
for(n=0;n<=Len;n++){xn[n] = 0;}
for(n=0;n<=Len*2;n++){xfft[n] = 0;}
/*
* Generating a sine Wave
*/
for(i=0; i<Len/2; i++){
xn[i+512] = sin((2 * 3.1415926 * i * freq)/Len);
}
N = Len;
/* Note: if Len/8 then it will only calculate the 1/8 th term from 0 only.*/
/*
* This loop calculates the x[n].e^(-j2.PI.n.k/N)
*/
for(k=0 ; k<N ; k++){
for(n=0 ; n<N; n++){
param = ((2 * M_PI * n * k)/N);
real = real + ( xn[n] * cos(param) );
imag = imag + ((-1) * xn[n] * sin(param) );
}
xfft[2 * k] = real;
xfft[(2 * k) + 1] = imag;
real = 0;
imag = 0;
}
/*
* Calculate phase angle of each frequency component
*/
float temp;
for(k=0; k<N/2;k++)
{
temp = xfft[(2 * k ) + 1] / xfft[2 * k];
phase[k] = atan(temp);
}
/*
* Calculate Magnitude of each frequency
*/
for(k=0; k<N/2;k++)
{
temp = sqrt( (xfft[(2 * k ) + 1] * xfft[(2 * k ) + 1] ) + ( xfft[2 * k] * xfft[2 * k] ) );
mag[k] = temp;
}
asm("nop"); //added to support for creating breakpoint during debug