Notepad++ is the one of the famous text editor tool for user. Notepad++ is available for installation version as well as portable version. Its a free tool. You can download from this link https://notepad-plus-plus.org/. NotePad++ is the best code editor for programming. This tools has awesome features like multi text edit, copy, past,
C Library – conio.h
The conio.h header file is a C library that provides functions for console input and output in the DOS and Windows environments. “Conio” stands for “console input/output”. This header file is not part of the standard C library and is specific to DOS and Windows systems.
Some commonly used functions declared in conio.h
include:
clrscr()
: Clears the screen.getch()
: Reads a character directly from the console without echoing it.getche()
: Reads a character directly from the console and echoes it.cprintf()
: Prints formatted output to the console.cscanf()
: Reads formatted input from the console.
It’s important to note that conio.h
is not standard and is not portable across different platforms or compilers. It was widely used in older DOS-based C programming, but it’s generally not recommended for modern development due to its lack of portability and non-standard nature. Most modern compilers, especially those targeting Unix-like systems, do not support conio.h
. Instead, developers typically use standard input/output functions from stdio.h
for console I/O.
getch()
The getch() function in conio.h reads a single character from keyboard. It doesn’t uses any buffer, so entered data is not displayed on the output screen.
C Library – windows.h
The windows.h
header file is a fundamental header file for the Microsoft Windows operating system. It includes declarations for a wide range of functions and data types used in Windows programming. Here’s a basic example demonstrating the usage of windows.h
for creating a simple Windows GUI application:
Contents
C Library – windows.h File
#include <windows.h> // Function prototype for the window procedure LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); int main() { // Get the handle to the instance of this application HINSTANCE hInstance = GetModuleHandle(NULL); // Create the main window HWND hwnd = CreateWindowEx( 0, // Optional window styles L"WindowClass", // Window class L"My First Window", // Window title WS_OVERLAPPEDWINDOW, // Window style // Size and position CW_USEDEFAULT, CW_USEDEFAULT, 800, 600, NULL, // Parent window NULL, // Menu hInstance, // Instance handle NULL // Additional application data ); // Display the window ShowWindow(hwnd, SW_SHOWNORMAL); // Enter the message loop MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return 0; } // The window procedure LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_DESTROY: PostQuitMessage(0); return 0; default: return DefWindowProc(hwnd, uMsg, wParam, lParam); } return 0; }
This above example creates a simple window using the Windows API. The WindowProc
function is the window procedure, which handles messages for the main window. The CreateWindowEx
function creates the main window, and the ShowWindow
function displays it. The program then enters a message loop (while (GetMessage...)
) where it waits for and processes messages until the user closes the window.
Remember that this is just a basic example, and real-world Windows applications will involve more complexities and considerations. Additionally, GUI programming in Windows often involves using additional libraries, such as MFC (Microsoft Foundation Classes) or newer frameworks like WinUI.
Predefined functions of C Library – windows.h
The windows.h
header in Windows programming provides declarations for various functions, data types, and constants used in Windows API. Here are some commonly used predefined functions available in windows.h
:
C Library – windows.h predefined functions List
Function Category | Function | Note |
---|---|---|
Window Management Functions: | CreateWindowEx() | Creates an extended window. |
ShowWindow() | Sets the specified window’s show state. | |
UpdateWindow() | Updates the client area of the specified window. | |
DestroyWindow() | Destroys the specified window. | |
DefWindowProc() | The default window procedure for window messages not processed by your window procedure. | |
Message Handling Functions: | GetMessage() | Retrieves a message from the calling thread’s message queue. |
TranslateMessage() | Translates virtual-key messages into character messages. | |
DispatchMessage() | Dispatches a message to a window procedure. | |
PostQuitMessage() | Posts a quit message to the message queue. | |
Thread Functions: | CreateThread() | Creates a new thread for parallel execution. |
GetCurrentThreadId() | Retrieves the thread identifier of the calling thread. | |
Synchronization Functions: | CreateMutex() | Creates or opens a named or unnamed mutex object. |
CreateEvent() | Creates or opens a named or unnamed event object. | |
WaitForSingleObject() | Waits until the specified object is in the signaled state. | |
ReleaseMutex() | Releases ownership of the specified mutex object. | |
File and File I/O Functions: | CreateFile() | Creates or opens a file or I/O device. |
ReadFile, WriteFile() | Reads from or writes to a file or I/O device. | |
CloseHandle() | Closes an open object handle. | |
Memory Management Functions: | VirtualAlloc() | Reserves or commits a region of memory within the virtual address space of a specified process. |
VirtualFree() | Releases, decommits, or releases and decommits a region of memory. | |
Time Functions: | GetSystemTime() | Retrieves the current system date and time. |
Sleep() | Suspends the execution of the current thread for a specified interval. | |
Miscellaneous Functions: | MessageBox() | Displays a modal dialog box that contains a system icon, a set of buttons, and a brief application-specific message. |
GetLastError() | Retrieves the calling thread’s last-error code value. | |
LoadLibrary, GetProcAddress() | Loads a dynamic-link library (DLL) into the calling process’s address space. |
Note
These are just a few examples, and there are many more functions provided by Windows.h for various purposes. When working with Windows programming, documentation is an essential resource to understand and use these functions effectively. The next section only discussed Sleep() function.
sleep() in C Library – windows.h
if you have the following questions like
- How to use the delay function in C?
- How to use the C program delay function in Windows?
Here is your solution,
If you wanna use the delay feature, you can use the Sleep()
function in the Windows platform, based on the compiler the Sleep()
will call in different library files(Some times Sleep function will be winbase.h
, Sometimes different). Don’t worry about that, if you include the windows.h
the header file, that will be taken care of. why because everything all the sleep function necessary headers are already included in windows.h
the file.
- Rule-1: You should add the header file
#include <windows.h>
- Rule-2:
function first letter always Uppercase, if you declare in the small case the compiler might generate error “Undefined reference to sleep”.Sleep()
- Rule-3:
Sleep()
function argument (Milliseconds) should be unsigned long type. If your call [Example :Sleep("ArunEworld")
]Sleep()
function with char type or other types, the compiler will generate an Error.
Please note that the sleep
function may not be very precise, and the actual delay could be slightly longer due to system-related factors. If you need more precise timing, you might want to explore other methods or libraries for that purpose.
Sleep() Example-1
Code
#include <stdio.h> #include <unistd.h> // for sleep function int main() { printf("ArunEworld: This is before the delay.\n"); // Sleep for 3 seconds sleep(3); printf("ArunEworld: This is after the delay.\n"); return 0; }
Explanation
In this above example, the program will print the first message, then pause for 3 seconds using sleep(3)
, and finally print the second message after the delay.
Remember to include the <unistd.h>
header for the sleep
function to work.
Sleep() Example-2
The below code will be printed ArunEworld website every 1 second
#include <stdio.h> #include <Windows.h> int main() { while(1) { //print the aruneworld website address printf("www.ArunEworld.com.\r\n"); //make a delay every in millisecond Sleep(1000); } return 0; }
Slep() Example-3
#include <stdio.h> #include <Windows.h> int main() { while(1) { //print the aruneworld website address printf("www.ArunEworld.com.\r\n"); //make a delay every in millisecond Sleep("ArunEworld"); } return 0; }
The above code will show the Error like "[Note] expected 'DWORD' but argument is of type 'char *'"
. Why because
the argument should be unsigned long. here ‘Sleep()
ArunEworld'
is a charter pointer.
Refer to the C Examples – Time Delay
Next
C Library – stdlib.h
stdlib.h in standard C Library header file that provides various functions to perform general utility tasks. It includes functions for memory allocation, process control, random number generation, string conversion, and other fundamental operations.
Key functions include malloc()
for dynamic memory allocation, free()
to release allocated memory, exit()
for program termination, atoi()
for converting strings to integers, and rand()
for generating pseudo-random numbers.
Additionally, <stdlib.h>
declares the NULL
macro for null pointers and defines the EXIT_SUCCESS
and EXIT_FAILURE
constants for program termination status.
Overall, <stdlib.h>
is essential for many C programs, offering foundational functionalities crucial for memory management, program flow control, and data conversion.
Functions List
functions are in below table, Refer this link for more info
Function | Description |
---|---|
abort() | Stop a Program. |
abs() | Calculate Integer Absolute Value. |
atexit() | Record Program Ending Function. |
atof() | Convert Character String to Float |
atoi() | Convert Character String to Integer |
atol() & atoll() | Convert Character String to Long or Long Long Integer |
bsearch() | Search Array |
calloc() | Reserve and Initialize Storage |
_C_Quickpool_Debug() | Modify Quick Pool Memory Manager Characteristics |
_C_Quickpool_Init() | Initialize Quick Pool Memory Manager. |
_C_Quickpool_Report() | Generate Quick Pool Memory Manager Report |
div() | Calculate Quotient and Reminder |
exit() | End Program |
free() | Release Storage Blocks |
_gcvt1() | Convert Floating Point to String |
getenv() | Search for Enviroment Variable |
_itoa1() | Convert Integer to String |
_ltoa1() | Convert Integer to String |
labs() | Calculate absolute value of long and long long Integer |
llabs() | Calculate absolute value of long and long long Integer |
ldiv() | Perform Long and Long Long Division |
lldiv() | Perform Long and Long Long Division |
malloc() | Reserve Storage Block |
mblen() | Determine Length of Multibyte Character |
mbstowcs() | Convert Multibyte String to a Wide Character String |
mbtowc() | Convert Multibyte Character to a Wide Character |
putenv() | Change/Add Environmental Variable |
qsort() | Sort Array |
rand() | Generate Random Number |
rand_r() | Generate Random Number |
realloc() | Change Reserved Storage Block Size |
srand() | Set Seed fr rand() Function |
strtod() | Convert Character String to Double, Float, and Long Double |
strtod32() | Convert Character String to Decimal Floating-Point |
strtod64() | Convert Character String to Decimal Floating-Point |
strtod128() | Convert Character String to Decimal Floating-Point |
strtof() | Convert Character String to Double, Float, and Long Double |
strtol() | Convert Character String to Long and Long Long Integer |
strtold() | Convert Character String to Double, Float, and Long Double |
strtoll() | Convert Character String to Long and Long Long Integer |
strtoul() | String to unsigned Long Integer |
strtoull() | String to Unsigned Long Long Integer |
system() | Execute a command |
_ultoa1() | Convert Unsigned Long Integer to String. |
wcstombs() | Convert a Wide Character to a Multibyte Character String |
wctomb() | Convert a Wide Character to a Multibyte Character |
CRC
A cyclic redundancy check (CRC) is an error-detecting code commonly used in digital networks and storage devices to identify accidental changes to raw data. Blocks of data entering these systems receive a short check value based on the remainder of a polynomial division of their contents. This method primarily detects data errors during data transmission and reception. Different types of Cheks are available based on the number of bits used.
The sender and receiver share a generator polynomial. They utilize it whenever storing or transmitting digital data. The risk of data corruption exists in such processes. To address this risk, transmitted messages undergo segmentation into predetermined lengths. Subsequently, these segments are divided by a fixed divisor, and the remainder of this division gets calculated and appended to the message before transmission. Upon message reception, the recipient recalculates the remainder and compares it to the transmitted remainder. If the numbers fail to match, an error is detected. This process contributes to ensuring the integrity of transmitted data in digital systems.
You can access web-based online tools for Error Check calculation at this link: https://crccalc.com/
C Library – stdio.h
The stdio.h header file in C is a standard input-output library that provides functions for input and output operations. It stands for “standard input-output header”. This header file declares several functions, including printf
, scanf
, fopen
, fclose
, fread
, fwrite
, etc., as well as various macros and data types.
std
means Standard andio
means Input-output statements- These statements are used to get and put data on computers
- Ex-1: Can put data to a computer via the keyboard.
- Ex-2: Can get data and see that in Monitor.
- Input-output statements are used as a function in c language
stdio.h
file contains that statements statements- So if we use these functions should include
stdio.h
, functions arescanf()
,printf()
,getchar()
,gets()
,putchar()
,puts()
.
Here’s a brief overview of some commonly used functions and macros declared in stdio.h
:
printf
: Used to print formatted output to the standard output (usually the console).scanf
: Used to read formatted input from the standard input (usually the keyboard).fprintf
,fscanf
,sprintf
,sscanf
: Variants ofprintf
andscanf
for performing formatted I/O operations on files or strings.FILE
: Data type representing a file stream used by functions likefopen
,fclose
,fread
,fwrite
, etc.stdin
,stdout
,stderr
: Predefined file streams representing standard input, standard output, and standard error respectively.
Including stdio.h
at the beginning of your C program allows you to use these functions and macros. It’s an essential header file for most C programs, as it provides basic input and output capabilities.
Embedded Protocol – XMODEM
Ward Christensen developed XMODEM, a straightforward file transfer protocol, in 1977. It frequently finds application between two computers employing the XMODEM protocol. The protocol initiates transmission with the ‘C’ character, followed by packets. The receiver provides proper acknowledgment (ACK) for each packet. Identification of the last packet is facilitated by EOT, and the completion of transmission is signaled by ETB.
C – structures and unions
In C programming, structures (struct
) and unions (union
) are fundamental data types used to organize and manipulate related data. They both allow grouping multiple variables of different data types into a single entity. However, they have distinct characteristics and usage scenarios.
A structure (struct
) is a composite data type that enables bundling together variables of different types under a single name. Structures commonly use to represent records, objects, or complex data structures, and each variable within a structure is called a member, which can be of any data type, including other structures or arrays.
On the other hand, a union (union
) is similar to a structure but with a key difference: all members of a union share the same memory location. This means that a union variable can hold only one value at a time, regardless of the number of members it has. Programmers often use unions when memory efficiency is crucial or when different data types need to share the same memory space.
In this introduction to “C – struct and union,” we will explore the syntax, usage, and differences between structures and unions in C, along with common scenarios where each data type is appropriate. We will also discuss best practices and potential pitfalls associated with using structures and unions in C programming.
differences between a union and a structure:
Feature | Union | Structure |
---|---|---|
Definition | A union is a data type that allows storing different types of data in the same memory location. | A structure is a composite data type that allows storing different types of data in a single variable. |
Memory Usage | Occupies memory space equal to the size of the largest member. | Occupies memory space equal to the sum of the sizes of its members. |
Data Sharing | Shares memory among its members. | Each member has its own memory space. |
Accessing Members | All members share the same memory location, so only one member can be accessed at a time. | Each member has its own memory location, and all members can be accessed independently. |
Use Cases | Useful when different data types need to share the same memory location to conserve memory. | Suitable for grouping related data together, such as representing a record or object. |
- The difference between structure and union is, … The amount of memory required to store a structure variable is the sum of the size of all the members.
- On the other hand, in case of unions, the amount of memory required is always equal to that required by its largest member.
Example -1 : struct inside union.
Consider the following C declaration, Assume that objects of the type short, float and long occupy 2 bytes, 4 bytes and 8 bytes, respectively. The memory requirement for variable t, ignoring alignment considerations, is (GATE CS 2000)
struct {
short s[5];
union {
float y;
long z;
}u;
}
Answer : 18
Short array s[5] will take 10 bytes as size of short is 2 bytes. When we declare a union, memory allocated for the union is equal to memory needed for the largest member of it, and all members share this same memory space. Since u is a union, memory allocated to u will be max of float y(4 bytes) and long z(8 bytes). So, total size will be 18 bytes (10 + 8).
NEXT
MP LAB
Contents
Shortcut
- Search word in whole project (SHIFT + Ctrl + F)
- Search word in current file (Ctrl + F)
- Change Font size Increase/Decrease in file (Alt + Mouse scroll ball)
TIME and Date
- __DATE__
- __TIME__
using __TIME__ and __DATE__ with the xc8 compiler I’m able to get the time and date as strings. As I don’t have a RTCC and only limited program and data memory, I want to implement the time & date functionality as efficiently as possible. So I’ve tried to use macros and thought this would save some memory, but unfortunately it does not.
- For example: this is the code I use to get the starting hour as an int:
#define BUILD_HOUR ((__TIME__[0] - '0') * 10 + __TIME__[1] - '0') int hour = BUILD_HOUR;// start value
I assumed that the preprocessor and compiler would optimize this, so I would not get a lot of addidtional memory usage. But the whole cumputation is done by the pic 12F1572 I use. Is there a better solution for this problem or any workaround ?
- Reference : https://www.microchip.com/forums/m1028043.aspx
ESP8266 Arduino-Core Interface – LED
LEDs have two legs, an anode (longer leg, positive) and a cathode (shorter leg, negative). Connect the anode to a current-limiting resistor and the other end of the resistor to the microcontroller’s output pin. Connect the cathode directly to the microcontroller’s ground (GND) pin. Interfacing an LED with an ESP8266 using the Arduino core is quite similar to the basic Arduino example. The ESP8266 Arduino core provides a convenient platform for programming ESP8266 modules with the Arduino IDE. Here’s a simple example of “interfacing an LED with an ESP8266 using an Arduino-core”ESP8266 Arduino-Core Interface – LED”:
8051 Interface – LCD
Interfacing an LCD (Liquid Crystal Display) with the 8051 microcontroller is a common practice in embedded systems for displaying information. Here’s a brief overview of 8051 Interface LCD
- Hardware Connections: Connect the data lines (D0-D7) of the LCD to the GPIO pins of the 8051. Connect the control lines (RS, RW, E) to specific GPIO pins. Optionally, connect the backlight control pin and adjust the contrast using a potentiometer.
- Initialization: Send initialization commands to the LCD to configure its operation mode, display settings, and other parameters. This typically involves sending specific command codes over the data lines.
- Sending Data: To display characters or strings on the LCD, send the ASCII codes of the characters over the data lines while setting the RS (Register Select) line appropriately to indicate data transmission mode.
- Sending Commands: To control the operation of the LCD (such as clearing the display, setting the cursor position, etc.), send command codes over the data lines while setting the RS line to indicate command transmission mode.
- Timing Considerations: Ensure proper timing between data/command transmissions and the strobing of the E (Enable) line to ensure reliable communication with the LCD.
- Busy Flag Checking: Check the busy flag of the LCD before sending new commands or data to ensure that the LCD is ready to receive new instructions.
- Writing Custom Characters: Some LCDs allow you to define custom characters by programming specific patterns into the CGRAM (Character Generator RAM) of the LCD.
- Example Code: Here’s a basic example of initializing and sending data to an LCD connected to an 8051 microcontroller:
Uses of LCD
- Displaying Information: LCDs (Liquid Crystal Displays) are used to visually display information such as text, numbers, and symbols.
- Interface Compatibility: They can be easily interfaced with 8051 microcontrollers through parallel or serial communication interfaces.
- Textual Output: LCDs allow for the display of textual information, making them suitable for user interfaces or information panels.
- Low Power Consumption: They typically consume less power compared to other display technologies, making them suitable for battery-powered devices.
- Compact Size: LCD modules come in various sizes, allowing for flexibility in design and integration into compact devices.
- Backlighting Options: Some LCD modules offer backlighting options, enabling visibility in low-light conditions.
- Dynamic Display: LCDs can be dynamically updated to show changing information or real-time data.
- Multipurpose Usage: They find applications in various domains such as digital clocks, thermometers, calculators, and industrial control panels.
Next will see about code of 8051 Interface LCD
Code Header file (LCD8.h)
#define LCD_First_Line 0x80 #define LCD_Second_Line 0xc0 #define LCD_Curser_On 0x0f #define LCD_Curser_Off 0x0c #define LCD_Clear_Display 0x01 #define Lcd8_Data_Port P2 sbit Lcd8_RS = P0^0; sbit Lcd8_RW = P0^1; sbit Lcd8_EN = P0^2; void Lcd8_Init(); void Lcd8_Command(unsigned char); void Lcd8_Write(unsigned char,unsigned char); void Lcd8_Display(unsigned char,const unsigned char*,unsigned int); void Lcd8_Decimal2(unsigned char,unsigned char); void Lcd8_Decimal3(unsigned char,unsigned char); void Lcd8_Decimal4(unsigned char,unsigned int); void Delay(unsigned int); void Lcd8_Init() { Lcd8_Command(0x38); //to select function set Lcd8_Command(0x06); //entry mode set Lcd8_Command(0x0c); //display on Lcd8_Command(0x01); //clear display } void Lcd8_Command(unsigned char com) { Lcd8_Data_Port=com; Lcd8_EN=1; Lcd8_RS=Lcd8_RW=0; Delay(125); Lcd8_EN=0; Delay(125); } void Lcd8_Write(unsigned char com,unsigned char lr) { Lcd8_Command(com); Lcd8_Data_Port=lr; // Data Lcd8_EN=Lcd8_RS=1; Lcd8_RW=0; Delay(125); Lcd8_EN=0; Delay(125); } void Lcd8_Display(unsigned char com,const unsigned char *word,unsigned int n) { unsigned char Lcd_i; for(Lcd_i=0;Lcd_i<n;Lcd_i++) { Lcd8_Write(com+Lcd_i,word[Lcd_i]); } } void Lcd8_Decimal2(unsigned char com,unsigned char val) { unsigned int Lcd_hr,Lcd_t,Lcd_o; Lcd_hr=val%100; Lcd_t=Lcd_hr/10; Lcd_o=Lcd_hr%10; Lcd8_Write(com,Lcd_t+0x30); Lcd8_Write(com+1,Lcd_o+0x30); } void Lcd8_Decimal3(unsigned char com,unsigned char val) { unsigned int Lcd_h,Lcd_hr,Lcd_t,Lcd_o; Lcd_h=val/100; Lcd_hr=val%100; Lcd_t=Lcd_hr/10; Lcd_o=Lcd_hr%10; Lcd8_Write(com,Lcd_h+0x30); Lcd8_Write(com+1,Lcd_t+0x30); Lcd8_Write(com+2,Lcd_o+0x30); } void Lcd8_Decimal4(unsigned char com,unsigned int val) { unsigned int Lcd_th,Lcd_thr,Lcd_h,Lcd_hr,Lcd_t,Lcd_o; val = val%10000; Lcd_th=val/1000; Lcd_thr=val%1000; Lcd_h=Lcd_thr/100; Lcd_hr=Lcd_thr%100; Lcd_t=Lcd_hr/10; Lcd_o=Lcd_hr%10; Lcd8_Write(com,Lcd_th+0x30); Lcd8_Write(com+1,Lcd_h+0x30); Lcd8_Write(com+2,Lcd_t+0x30); Lcd8_Write(com+3,Lcd_o+0x30); } void Delay(unsigned int del) { while(del--); }
Code Main File (LCD8_Interface_Main.c)
#include<reg51.h> #include "LCD8.h" void timer_init(void); static unsigned char i; static unsigned int x=100,y=150,cnt; void main() { Lcd8_Init(); Lcd8_Display(LCD_First_Line," Hello World ",16); while(1) { Lcd8_Display(LCD_Second_Line," ArunEworld.com ",16); }//while(1) }//void main()
Electronic Devices – Inductor
An inductor is a coil of wound on a core. An inductor opposes the sudden variation of current. an inductor stores the energy in the form of current in magnetic field. The coil blocks DC voltage.an inductor allows the Direct current
L=µ o µr A N2/l Henry
- l=length of the core,
- µ o=permeability of free space,
- µr=relative permeability of the core material,
- A=area of cross-section of the coil, N=length of the core,
8051 Interface – Servo
This tutorial demonstrates how to interface a servo motor with an 8051 microcontroller, allowing precise control over the motor’s position and movement.
One of the most commonly used motors for precise angular movement is the stepper motor. Its advantage lies in its ability to control the angular position without requiring any feedback mechanism. It finds widespread use in industrial and commercial applications, moreover, it is commonly employed in drive systems such as robots and washing machines.
8051 Interface – Keypad
In this tutorial, we’ll explore the process of interface a 4×4 or 4×3 matrix keypad with the 8051 microcontroller. Its versatility and ease of interfacing with external peripherals make the 8051 microcontroller a popular choice for various embedded systems. One common peripheral is the keypad, which serves as an input device in numerous applications such as security systems, industrial control systems, and consumer electronics.
Interfacing a keypad with the 8051 microcontroller involves connecting the keypad’s rows and columns to specific pins on the microcontroller. The keypad typically consists of a matrix of switches arranged in rows and columns. When a key is pressed, it connects a particular row to a specific column, enabling the microcontroller to detect the pressed key by scanning the rows and columns.
We’ll discuss the hardware connections required and the software implementation to read the pressed keys. Additionally, we’ll demonstrate how to display the pressed keys on an LCD (Liquid Crystal Display) connected to the microcontroller, providing a user-friendly interface for input.
By the end of this tutorial, you’ll have a solid understanding of how to interface a keypad with the 8051 microcontroller, enabling you to incorporate user input functionality into your embedded systems projects.
A widely used input device, the keypad, features in various applications like telephones, computers, ATMs, electronic locks, etc., enabling users to input data for further processing. In this setup, we interface a 4×3 matrix keypad, consisting of switches arranged in rows and columns, with the microcontroller. Additionally, we interface a 16×2 LCD to display the output. The concept of interfacing the keypad is straightforward: each key on the keypad has two unique parameters, row and column (R, C). Whenever a key is pressed, the microcontroller identifies the pressed key by detecting its corresponding row and column numbers on the keypad.
Mongoose-OS – Get Start
Getting started with Mongoose OS (MOS) is pretty straightforward. That’s a basic overview of getting started with Mongoose OS. As you become more familiar with the platform, you can explore more advanced features and capabilities offered by Mongoose OS for developing IoT applications.
Read more: Mongoose-OS – Get StartGet started
Here’s a shortened version of the installation and setup process for Mongoose OS:
- Installation: Install Mongoose OS on your machine by following the instructions on the Mongoose OS documentation website. You can use a package manager like npm or pip, or download the binaries directly.
- Environment Setup: Configure your IDE or text editor to work with Mongoose OS projects. Install any additional tools or SDKs required for your target platform.
- Creating a Project: Use the Mongoose OS CLI to create a new project. Run
mos init
in your desired directory to initialize a new project. - Project Configuration: Customize your project by editing the
mos.yml
file in your project directory. Configure settings such as device type and communication protocols. - Application Development: Write your application code in C/C++ or JavaScript. Create new source files in the
fs
directory of your project. - Building and Flashing: Compile your application code with
mos build
. Flash the firmware to your device withmos flash
. Ensure your device is connected via USB. - Device Monitoring: Monitor your device’s logs and interact with it using
mos console
. View debug output and send commands from the console. - Debugging and Iteration: Test your application on the device, debug any issues, and iterate on your code. Use
mos
command-line tools for managing your device and updating firmware as needed.
Mongoose-OS IDE’s
- Web Browser based
- Local server in PC (Mos tool – http://127.0.0.1:1992/ )
- Cloud server (Dashboard : https://dash.mongoose-os.com/)
- Visual basic extensions
mos tool
What is mos tool ?
- We need IDE for our project development.
- mos tool like a web browser-based IDE.
- we can use the mos tool to firmware upload & update, Build the firmware from c source, debug purpose and so on.
You must be logged in to post a comment.