Tag: C Program
-
How to Use C SDK to Create UF2 file which Interface Ultrasonic Sensor with Raspberry Pi Pico
Hardware setup HC-SR04 Raspberry Pi Pico VCC VSYS GND GND Trig GP2 ECHO GP3 I am using raspberry pi model 3 b+ for the code compilation. If everything worked, you will have your ulf2 file in your build directory
-
Merge Sort is bad for Embedded System
Merge sort is good if your system has plenty of memory to accommodate the temporary array. Embedded systems have very limited memory and it is often fixed. If the system has some other function that also runs concurrently. Then that memory also gets shortened. Merge sort is good for a bigger system like the personal…
-
Swapping of two numbers
Before Swapping :a = 10b = 2 After Swapping:a = 2b = 10 To do the swapping we have different approaches. 1. Swapping using a temporary variable2. Swapping without using a temporary variable3. Swapping using pointers NOTE: We do not use of the second method in embedded system software writing. Because it would have to…
-
How to Perform Discrete Fourier Transform on N-Point Sequence using STM32L476G
x(n) = { 0, 1, 0, 1} Here x(n) is a 4 point sequence 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…
-
Stack implementation without pointer
Stack is a type of data structure, where data is stored in Last In First Out fashion. In embedded system there are different kind of stacks available. They are implemented in hardware and software. The hardware implementation of stack is faster than software stack; but the size of stack in hardware is limited. There are…
-
Union
Union is another user defined data type. The difference between union and struct is that; struct uses a contagious memory allocation for each individual item inside it; whereas union uses the size of biggest element for allocation of memory.