Skip to main content

Posts

[Basic] C program and SRAM, flash, stack, heap ... Why microcontrollers use different types of memory like that?

Preface When you build the source code in C/C++, you might see some output messages as the blow: Flash used: 1166 of 262144 bytes (0.4%). SRAM used: 2505 of 65536 bytes (3.8%). Stack: 2048 bytes. Heap: 128 bytes. --------------- Rebuild Succeeded: 10/01/2024 17:46:40 --------------- Figure 1: The output message from PSoC Creator Figure 2: The output message from Arduino IDE Have you asked yourself what are technical jargon such as flash, stack, and heap? In short, they are kinds of memory for machines. Microcontrollers use different types of memory (Flash, SRAM, EEPROM, etc.) because each type serves a specific purpose, balancing factors like cost, speed, power consumption, and data persistence . Key Differences Between These Memory Types: The explanation for the output message in the figure 1: Flash used : 1222 of 262144 bytes (0.5%) The program's code occupies 1222 bytes of the total available 262144 bytes in Flash memory. This is a very small portion, showing efficient memory us
Recent posts

[C++] Apply the primary principle of C++ for preparing a meal

  Let's apply the principle of C++ (object-based programming) to the task of preparing a meal. In object-based programming, we break down tasks into objects that represent real-world entities. These objects have attributes (data) and methods (actions they can perform). Example: Preparing a Meal in C++ Style Imagine you're preparing a meal with different objects, each responsible for a specific part of the process. For simplicity, let's define three main objects: Chef , Ingredients , and KitchenTools . 1. Chef Object : Attributes : Name, experience level. Methods : prepareMeal() , useTool() , mixIngredients() . 2. Ingredients Object : Attributes : Type (vegetables, meat, spices), quantity, freshness. Methods : chop() , cook() , serve() . 3. KitchenTools Object : Attributes : Tool type (knife, pan, oven), condition (new, used). Methods : cut() , heat() , stir() . C++-Style Meal Preparation Example: Here’s how we would code a meal preparation process in C++: Breakdown: The

[MiniProject] Convert Vietnamese unicode strings to unaccented strings

 Recently, I embarked on an exciting Arduino project where I needed to convert Vietnamese Unicode strings into their unaccented equivalents. The goal was simple, but I quickly ran into a problem: the conversion process wasn’t working as expected. Characters like "Độc lập tự do" were returning as a string of question marks! I reached out for help and discovered that the issue was rooted in the way UTF-8 encoding was handled in my code. With some guidance, I learned how to properly decode UTF-8 characters into their Unicode equivalents before converting them. By breaking down the string into manageable arrays and thoroughly testing each case, I finally got the correct output: "Doc lap tu do." This project taught me the importance of understanding encoding and the value of community support in problem-solving. Now, my Arduino project runs smoothly, converting Vietnamese text as intended! The serial Monitor output: Unicode & Vietnamese Legacy Character Encodings htt

[Vi] Công nghệ phát triển ngược đời - How is AI harming my world

Tiếng cười khanh khách của mấy cậu sinh viên quốc tế người Bắc Ấn sau bài kiểm tra cuối khóa (a final exam) làm gã thấy buồn một góc tâm hồn. Sự trống rỗng ngay lập tức xâm chiếm lấy tâm trí gã sau khi nộp bài môn thi cuối cùng của kỳ học. Gã hiểu gã quá mà, gã đang cố gắng giải thích cho nỗi nhục của chính bản thân ở bên trong. Đầu gã thoáng nghĩ về cái lần thi cuối kỳ một môn học ở bậc thạc sỹ nơi quê nhà hơn mười năm về trước, cái ánh mắt khinh bỉ đến ám ảnh của một anh dọn vệ sinh dành cho những học viên cao học đang quay cóp trong giờ thi của một trường đại học hàng đầu quốc gia như vết dao khứa vào lòng tự trọng của gã. Vết thương vẫn nhói đau lại khi những mùa thi đến. Một lão già sinh viên quốc tế ranh ma. Gã đang học lại cái thứ mà gã đã học từ hai mươi năm về trước với một thứ ngôn ngữ không mới và cái tâm bằng sắt nung. Kinh nghiệm làm việc chuyên môn lâu năm cộng với việc vừa được trang bị thứ vũ khí khoa học tối tân AI (Trí truệ nhân tạo) khiến lão trở thành sát thủ trong

[MyThought] Software design scalability, how to navigate conflicting perspectives

 Your team disagrees on software design scalability. How do you navigate conflicting perspectives? First of all, disagreements usually come from different viewpoints and personal biases. When people look at a problem, they each see it from their own perspective. To make sure everyone’s on the same page, it helps to list out the main issues before jumping into brainstorming. Remember, how scalable the software is will depend on both the project’s budget and timeline. Secondly, based on the project's budget and timeline, team members are encouraged to share their thoughts freely during the brainstorming session. Afterward, we'll gather the most outstanding ideas and compile them into a table of options. We'll then weigh these options based on several criteria, and finally, we'll select the top-ranked one. Moreover, I work in the field of embedded software. Whenever we design a new product, we must consider both the hardware and software aspects. Hardware is always the fir

Navigating Embedded AI: A Friendly Guide for Junior Students

Embedded AI algorithms might sound complicated, but they're just a bit different from the AI you might know from general-purpose computers. These differences come from the unique needs and limitations of embedded systems, like those in your smartphone or a smart fridge. Let's explore these differences and see how they shape the way we design and use AI in these cool devices! #### 1. Working with Limited Resources **Memory and Storage:**    Embedded systems usually don't have a lot of memory or storage. Think of them like tiny apartments compared to big houses (general-purpose computers). So, when we write algorithms for them, we need to make sure they don't take up too much space. It's all about being efficient! **Processing Power:**   These devices often have less powerful processors. It's like comparing a bike to a car; you can't go as fast, but you can still get where you're going. Our algorithms need to be lightweight and quick so they can run smooth

How to use ChatGPT to get your resume shortlisted?

How to use ChatGPT to get your resume shortlisted? Core steps: Chat GPT -> Resume Creator -> LinkedIn(Copy the job description to ChatGPT) -> Add your personal information -> Copy output from ChatGPT to Instaresume.io to make the template -> Goto SkillSyncer to check ATS(Applicant Tracking Software) score, point out the missing keywords. Detail ☑️In my pursuit of job #opportunities, I encountered a familiar challenge - my resume seemingly disappeared into oblivion, yielding no responses despite my diverse skill set and numerous applications. ☑️As I delved into my research, I uncovered the existence of ATS software, the automated gatekeeper of #resumes, which swiftly filtered out those lacking relevant keywords. ☑️The outcome? Not just one #company, but over a dozen organizations recognized the potential in my resume, resulting in multiple shortlists and promising #job prospects! 💻If you want to supercharge your resume and unlock countless opportunities, don't miss o