├── Images ├── Step0.png ├── Step1.png ├── Step2.png ├── Step3.png ├── Step4.png ├── Step5.png ├── Step6.png └── Step7.png ├── .gitignore ├── Sources └── Parallel Driver │ └── Multiplexing │ ├── Examples │ └── 4Digit_CC_Delay │ │ ├── Simulation.pdsprj │ │ ├── src │ │ ├── main.c │ │ └── Seg7.c │ │ ├── .vscode │ │ └── extensions.json │ │ ├── test │ │ └── README │ │ ├── platformio.ini │ │ ├── lib │ │ └── README │ │ └── include │ │ ├── README │ │ ├── aKaReZa.h │ │ └── Seg7.h │ ├── Seg7.h │ └── Seg7.c ├── Multiplexing4Digit.md ├── Basics.md ├── API_Reference.md ├── README.md └── LICENSE /Images/Step0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aKaReZa75/AVR_7Segments_GPIO/HEAD/Images/Step0.png -------------------------------------------------------------------------------- /Images/Step1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aKaReZa75/AVR_7Segments_GPIO/HEAD/Images/Step1.png -------------------------------------------------------------------------------- /Images/Step2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aKaReZa75/AVR_7Segments_GPIO/HEAD/Images/Step2.png -------------------------------------------------------------------------------- /Images/Step3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aKaReZa75/AVR_7Segments_GPIO/HEAD/Images/Step3.png -------------------------------------------------------------------------------- /Images/Step4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aKaReZa75/AVR_7Segments_GPIO/HEAD/Images/Step4.png -------------------------------------------------------------------------------- /Images/Step5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aKaReZa75/AVR_7Segments_GPIO/HEAD/Images/Step5.png -------------------------------------------------------------------------------- /Images/Step6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aKaReZa75/AVR_7Segments_GPIO/HEAD/Images/Step6.png -------------------------------------------------------------------------------- /Images/Step7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aKaReZa75/AVR_7Segments_GPIO/HEAD/Images/Step7.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/.pio 2 | **/.vscode/.browse.c_cpp.db* 3 | **/.vscode/c_cpp_properties.json 4 | **/.vscode/launch.json 5 | **/.vscode/ipch 6 | **/*.workspace 7 | **/Project Backups -------------------------------------------------------------------------------- /Sources/Parallel Driver/Multiplexing/Examples/4Digit_CC_Delay/Simulation.pdsprj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aKaReZa75/AVR_7Segments_GPIO/HEAD/Sources/Parallel Driver/Multiplexing/Examples/4Digit_CC_Delay/Simulation.pdsprj -------------------------------------------------------------------------------- /Sources/Parallel Driver/Multiplexing/Examples/4Digit_CC_Delay/src/main.c: -------------------------------------------------------------------------------- 1 | #include "aKaReZa.h" 2 | 3 | uint32_t Counter = 0; 4 | 5 | int main(void) 6 | { 7 | Seg7_init(); 8 | while(1) 9 | { 10 | //Counter++; 11 | //Seg7_Puti((uint16_t) (Counter/1000)); 12 | Seg7_Puti(1234); 13 | delay_ms(1); 14 | }; 15 | }; -------------------------------------------------------------------------------- /Sources/Parallel Driver/Multiplexing/Examples/4Digit_CC_Delay/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "platformio.platformio-ide" 6 | ], 7 | "unwantedRecommendations": [ 8 | "ms-vscode.cpptools-extension-pack" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /Sources/Parallel Driver/Multiplexing/Examples/4Digit_CC_Delay/test/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for PlatformIO Test Runner and project tests. 3 | 4 | Unit Testing is a software testing method by which individual units of 5 | source code, sets of one or more MCU program modules together with associated 6 | control data, usage procedures, and operating procedures, are tested to 7 | determine whether they are fit for use. Unit testing finds problems early 8 | in the development cycle. 9 | 10 | More information about PlatformIO Unit Testing: 11 | - https://docs.platformio.org/en/latest/advanced/unit-testing/index.html 12 | -------------------------------------------------------------------------------- /Sources/Parallel Driver/Multiplexing/Examples/4Digit_CC_Delay/platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; https://docs.platformio.org/page/projectconf.html 10 | 11 | [env:ATmega328P] 12 | platform = atmelavr 13 | board = ATmega328P 14 | framework = arduino 15 | board_build.f_cpu = 16000000UL 16 | upload_port = COM4 17 | monitor_speed = 115200 18 | build_flags = -Wl,-u,vfprintf -lprintf_flt -lm -------------------------------------------------------------------------------- /Sources/Parallel Driver/Multiplexing/Examples/4Digit_CC_Delay/lib/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link into executable file. 4 | 5 | The source code of each library should be placed in an own separate directory 6 | ("lib/your_library_name/[here are source files]"). 7 | 8 | For example, see a structure of the following two libraries `Foo` and `Bar`: 9 | 10 | |--lib 11 | | | 12 | | |--Bar 13 | | | |--docs 14 | | | |--examples 15 | | | |--src 16 | | | |- Bar.c 17 | | | |- Bar.h 18 | | | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html 19 | | | 20 | | |--Foo 21 | | | |- Foo.c 22 | | | |- Foo.h 23 | | | 24 | | |- README --> THIS FILE 25 | | 26 | |- platformio.ini 27 | |--src 28 | |- main.c 29 | 30 | and a contents of `src/main.c`: 31 | ``` 32 | #include 33 | #include 34 | 35 | int main (void) 36 | { 37 | ... 38 | } 39 | 40 | ``` 41 | 42 | PlatformIO Library Dependency Finder will find automatically dependent 43 | libraries scanning project source files. 44 | 45 | More information about PlatformIO Library Dependency Finder 46 | - https://docs.platformio.org/page/librarymanager/ldf.html 47 | -------------------------------------------------------------------------------- /Sources/Parallel Driver/Multiplexing/Examples/4Digit_CC_Delay/include/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project header files. 3 | 4 | A header file is a file containing C declarations and macro definitions 5 | to be shared between several project source files. You request the use of a 6 | header file in your project source file (C, C++, etc) located in `src` folder 7 | by including it, with the C preprocessing directive `#include'. 8 | 9 | ```src/main.c 10 | 11 | #include "header.h" 12 | 13 | int main (void) 14 | { 15 | ... 16 | } 17 | ``` 18 | 19 | Including a header file produces the same results as copying the header file 20 | into each source file that needs it. Such copying would be time-consuming 21 | and error-prone. With a header file, the related declarations appear 22 | in only one place. If they need to be changed, they can be changed in one 23 | place, and programs that include the header file will automatically use the 24 | new version when next recompiled. The header file eliminates the labor of 25 | finding and changing all the copies as well as the risk that a failure to 26 | find one copy will result in inconsistencies within a program. 27 | 28 | In C, the usual convention is to give header files names that end with `.h'. 29 | It is most portable to use only letters, digits, dashes, and underscores in 30 | header file names, and at most one dot. 31 | 32 | Read more about using header files in official GCC documentation: 33 | 34 | * Include Syntax 35 | * Include Operation 36 | * Once-Only Headers 37 | * Computed Includes 38 | 39 | https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html 40 | -------------------------------------------------------------------------------- /Sources/Parallel Driver/Multiplexing/Examples/4Digit_CC_Delay/include/aKaReZa.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file aKaReZa.h 3 | * @brief Header file for AVR microcontrollers. 4 | * @note This file is designed for use with AVR microcontrollers. 5 | * 6 | * @author Hossein Bagheri 7 | * @github https://github.com/aKaReZa75 8 | * 9 | * @note For a complete list of all macros in this header file, 10 | * along with detailed explanations and examples of usage, visit: 11 | * https://github.com/aKaReZa75/AVR/blob/main/Macros.md 12 | */ 13 | 14 | #ifndef _aKaReZa_H_ 15 | #define _aKaReZa_H_ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include "Seg7.h" 24 | 25 | #define bitSet(_Reg, _Bit) (_Reg |= (1<<_Bit)) 26 | #define bitClear(_Reg, _Bit) (_Reg &= ~(1<<_Bit)) 27 | #define bitToggle(_Reg, _Bit) (_Reg ^= 1<<_Bit) 28 | #define bitChange(_Reg, _Bit, Value) (Value == 1 ? bitSet(_Reg, _Bit) : bitClear(_Reg, _Bit)) 29 | #define bitCheck(_Reg, _Bit) ((_Reg>>_Bit) & 0x01) 30 | #define bitCheckHigh(_Reg, _Bit) (bitCheck(_Reg, _Bit)) 31 | #define bitCheckLow(_Reg, _Bit) (!bitCheck(_Reg, _Bit)) 32 | #define bitWaitHigh(_Reg, _Bit) while(bitCheckLow(_Reg, _Bit)) 33 | #define bitWaitLow(_Reg, _Bit) while(bitCheckHigh(_Reg, _Bit)) 34 | #define bitShiftLeft(_Reg, _Pos) (_Reg = _Reg << _Pos) 35 | #define bitShiftRight(_Reg, _Pos) (_Reg = _Reg >> _Pos) 36 | #define Conv_16to8_MSB(_Value) (uint8_t) (_Value >> 8) 37 | #define Conv_16to8_LSB(_Value) (uint8_t) (_Value & 0xFF) 38 | #define Combine_8to16(_valueHigh, _valueLow) (uint16_t) (_valueLow + (_valueHigh<<8)) 39 | 40 | #define GPIO_Config_OUTPUT(_Reg, _Bit) bitSet(_Reg, _Bit) 41 | #define GPIO_Config_INPUT(_Reg, _Bit) bitClear(_Reg, _Bit) 42 | #define delay_ms(_delay_msValue) _delay_ms(_delay_msValue) 43 | #define globalInt_Enable bitSet (SREG, SREG_I) 44 | #define globalInt_Disable bitClear(SREG, SREG_I) 45 | #define intFlag_clear(Reg, Bit) bitSet(Reg, Bit) 46 | #define Initialize true 47 | #define deInitialize false 48 | 49 | #define Math_Const_PI 3.14159265358979 50 | #define MATH_Const_EXP 2.71828182845904 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /Multiplexing4Digit.md: -------------------------------------------------------------------------------- 1 | ## Multiplexing with 4-Digit 7-Segment Display 2 | 3 | When working with multiple 7-segment displays (e.g., a 4-digit display), the microcontroller typically uses a technique called **multiplexing** to manage the display of each digit. Multiplexing allows you to control several digits with fewer pins by switching between the digits rapidly in a way that makes it appear as though all digits are displayed simultaneously. 4 | 5 | ``` 6 | 4 3 2 1 7 | ----- ----- ----- ----- 8 | | | | | | | | | 9 | ----- ----- ----- ----- 10 | | | | | | | | | 11 | ----- ----- ----- ----- 12 | ``` 13 | 14 | ### How Multiplexing Works: 15 | In multiplexing, the microcontroller switches between digits one by one, activating only one digit at a time while keeping the others turned off. Each digit is displayed for a short period, and the cycle repeats for the next digit. The human eye perceives this rapid switching as continuous display of all digits. 16 | 17 | - **Each digit** of the 7-segment display has its own common pin (e.g., the common cathode or common anode), and these common pins are controlled to switch between digits. 18 | - **For example**, for a 4-digit display, you have four common pins, each connected to one of the 7-segment displays. The segments of the display are connected to GPIO pins of the microcontroller, and only one digit is activated at a time. 19 | 20 | #### How Digits are Displayed: 21 | 1. The microcontroller lights up the first digit (e.g., the first 7-segment display). 22 | 2. The corresponding segments are activated to show the number. 23 | 3. The microcontroller turns off the first digit and turns on the second digit. 24 | 4. The same process repeats for the third and fourth digits. 25 | 5. The cycle continues at a fast enough rate that it seems like all digits are being displayed at once. 26 | 27 | This process is done so quickly (at a high refresh rate) that the human eye perceives a smooth, continuous display of all four digits. 28 | 29 | ### Refresh Rate for Multiplexing: 30 | To avoid flickering or noticeable gaps in the display, the microcontroller needs to switch between digits at a rate that is fast enough for the human eye to not notice the switching. The general rule of thumb is to refresh the display **at least 50 Hz**, which means the display should be updated 50 times per second. 31 | 32 | - For **4 digits**, this means that each digit should be displayed for approximately 1/4th of the total refresh cycle. 33 | - The **total refresh rate** for all four digits is typically set at **50 Hz** or higher. This implies that each digit should be refreshed approximately every **5 ms** (milliseconds). 34 | 35 | Thus, for a 50 Hz refresh rate: 36 | - Each digit should be displayed for around **5 ms** before switching to the next digit. 37 | 38 | If you want to achieve a smoother display with no visible flickering, it's ideal to aim for a refresh rate of **100 Hz or higher**. This means each digit would be refreshed every **2.5 ms**. 39 | 40 | #### Example Calculation: 41 | - If you're targeting a **refresh rate of 100 Hz**, the total time to refresh all four digits would be 10 ms (since 1 / 100 Hz = 10 ms). 42 | - For each digit to be displayed in this 10 ms cycle, each digit should be refreshed for approximately **2.5 ms** (since 10 ms ÷ 4 digits = 2.5 ms per digit). 43 | 44 | # 🌟 Support Me 45 | If you found this repository useful: 46 | - Subscribe to my [YouTube Channel](https://www.youtube.com/@aKaReZa75). 47 | - Share this repository with others. 48 | - Give this repository and my other repositories a star. 49 | - Follow my [GitHub account](https://github.com/aKaReZa75). 50 | 51 | # ✉️ Contact Me 52 | Feel free to reach out to me through any of the following platforms: 53 | - 📧 [Email: aKaReZa75@gmail.com](mailto:aKaReZa75@gmail.com) 54 | - 🎥 [YouTube: @aKaReZa75](https://www.youtube.com/@aKaReZa75) 55 | - 💼 [LinkedIn: @akareza75](https://www.linkedin.com/in/akareza75) 56 | -------------------------------------------------------------------------------- /Sources/Parallel Driver/Multiplexing/Seg7.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Seg7.c 3 | * @brief 7-segment display control library for AVR microcontrollers 4 | * @note This file provides functionality to control a 4-digit 7-segment display 5 | * using multiplexing for AVR microcontrollers. 6 | * 7 | * @author Your Name 8 | * @github Your GitHub Link 9 | * 10 | * @note For detailed explanations of this library, along with additional notes and examples of usage, 11 | * please visit the following repository: 12 | * https://github.com/aKaReZa75/AVR_7Segments 13 | */ 14 | #ifndef _Seg7_H_ 15 | #define _Seg7_H_ 16 | 17 | #include "aKaReZa.h" 18 | 19 | /** 20 | * @brief Control and configuration macros for 7-segment display segments (A to G). 21 | * 22 | * These macros define the control ports, configuration ports, and pins for each segment of the 7-segment display. 23 | */ 24 | 25 | /* Define control and configuration for segment A */ 26 | #define __7Seg_A_Control PORTC /**< Control port for segment A */ 27 | #define __7Seg_A_Config DDRC /**< Data direction register for segment A */ 28 | #define __7Seg_A_Pin 0 /**< Pin number for segment A */ 29 | 30 | /* Define control and configuration for segment B */ 31 | #define __7Seg_B_Control PORTC /**< Control port for segment B */ 32 | #define __7Seg_B_Config DDRC /**< Data direction register for segment B */ 33 | #define __7Seg_B_Pin 1 /**< Pin number for segment B */ 34 | 35 | /* Define control and configuration for segment C */ 36 | #define __7Seg_C_Control PORTC /**< Control port for segment C */ 37 | #define __7Seg_C_Config DDRC /**< Data direction register for segment C */ 38 | #define __7Seg_C_Pin 2 /**< Pin number for segment C */ 39 | 40 | /* Define control and configuration for segment D */ 41 | #define __7Seg_D_Control PORTC /**< Control port for segment D */ 42 | #define __7Seg_D_Config DDRC /**< Data direction register for segment D */ 43 | #define __7Seg_D_Pin 3 /**< Pin number for segment D */ 44 | 45 | /* Define control and configuration for segment E */ 46 | #define __7Seg_E_Control PORTD /**< Control port for segment E */ 47 | #define __7Seg_E_Config DDRD /**< Data direction register for segment E */ 48 | #define __7Seg_E_Pin 0 /**< Pin number for segment E */ 49 | 50 | /* Define control and configuration for segment F */ 51 | #define __7Seg_F_Control PORTD /**< Control port for segment F */ 52 | #define __7Seg_F_Config DDRD /**< Data direction register for segment F */ 53 | #define __7Seg_F_Pin 1 /**< Pin number for segment F */ 54 | 55 | /* Define control and configuration for segment G */ 56 | #define __7Seg_G_Control PORTD /**< Control port for segment G */ 57 | #define __7Seg_G_Config DDRD /**< Data direction register for segment G */ 58 | #define __7Seg_G_Pin 4 /**< Pin number for segment G */ 59 | 60 | /* Define control and configuration for decimal point (DP) */ 61 | #define __7Seg_DP_Control PORTD /**< Control port for the decimal point (DP) */ 62 | #define __7Seg_DP_Config DDRD /**< Data direction register for DP */ 63 | #define __7Seg_DP_Pin 7 /**< Pin number for the decimal point (DP) */ 64 | 65 | /* Define control and configuration for each digit */ 66 | #define __7Seg_Digit1_Control PORTB /**< Control port for Digit 1 */ 67 | #define __7Seg_Digit1_Config DDRB /**< Data direction register for Digit 1 */ 68 | #define __7Seg_Digit1_Pin 0 /**< Pin number for Digit 1 */ 69 | 70 | #define __7Seg_Digit2_Control PORTB /**< Control port for Digit 2 */ 71 | #define __7Seg_Digit2_Config DDRB /**< Data direction register for Digit 2 */ 72 | #define __7Seg_Digit2_Pin 1 /**< Pin number for Digit 2 */ 73 | 74 | #define __7Seg_Digit3_Control PORTB /**< Control port for Digit 3 */ 75 | #define __7Seg_Digit3_Config DDRB /**< Data direction register for Digit 3 */ 76 | #define __7Seg_Digit3_Pin 2 /**< Pin number for Digit 3 */ 77 | 78 | #define __7Seg_Digit4_Control PORTB /**< Control port for Digit 4 */ 79 | #define __7Seg_Digit4_Config DDRB /**< Data direction register for Digit 4 */ 80 | #define __7Seg_Digit4_Pin 4 /**< Pin number for Digit 4 */ 81 | 82 | /** 83 | * @brief Initializes the 7-segment display. 84 | * 85 | * This function configures the appropriate ports and pins for controlling the 7-segment display. 86 | * It sets the direction for each pin (input/output) and initializes the display for use. 87 | */ 88 | void Seg7_init(void); 89 | 90 | /** 91 | * @brief Displays a number on the 7-segment display. 92 | * 93 | * This function takes a 4-digit value (0-9999) and displays it on the 7-segment display using multiplexing. 94 | * It will handle sequentially displaying each digit with appropriate timing. 95 | * 96 | * @param _7SegValue The 4-digit number to be displayed on the 7-segment display. 97 | */ 98 | void Seg7_Puti(uint16_t _7SegValue); 99 | 100 | #endif 101 | -------------------------------------------------------------------------------- /Sources/Parallel Driver/Multiplexing/Examples/4Digit_CC_Delay/include/Seg7.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Seg7.c 3 | * @brief 7-segment display control library for AVR microcontrollers 4 | * @note This file provides functionality to control a 4-digit 7-segment display 5 | * using multiplexing for AVR microcontrollers. 6 | * 7 | * @author Your Name 8 | * @github Your GitHub Link 9 | * 10 | * @note For detailed explanations of this library, along with additional notes and examples of usage, 11 | * please visit the following repository: 12 | * https://github.com/aKaReZa75/AVR_7Segments 13 | */ 14 | #ifndef _Seg7_H_ 15 | #define _Seg7_H_ 16 | 17 | #include "aKaReZa.h" 18 | 19 | /** 20 | * @brief Control and configuration macros for 7-segment display segments (A to G). 21 | * 22 | * These macros define the control ports, configuration ports, and pins for each segment of the 7-segment display. 23 | */ 24 | 25 | /* Define control and configuration for segment A */ 26 | #define __7Seg_A_Control PORTC /**< Control port for segment A */ 27 | #define __7Seg_A_Config DDRC /**< Data direction register for segment A */ 28 | #define __7Seg_A_Pin 0 /**< Pin number for segment A */ 29 | 30 | /* Define control and configuration for segment B */ 31 | #define __7Seg_B_Control PORTC /**< Control port for segment B */ 32 | #define __7Seg_B_Config DDRC /**< Data direction register for segment B */ 33 | #define __7Seg_B_Pin 1 /**< Pin number for segment B */ 34 | 35 | /* Define control and configuration for segment C */ 36 | #define __7Seg_C_Control PORTC /**< Control port for segment C */ 37 | #define __7Seg_C_Config DDRC /**< Data direction register for segment C */ 38 | #define __7Seg_C_Pin 2 /**< Pin number for segment C */ 39 | 40 | /* Define control and configuration for segment D */ 41 | #define __7Seg_D_Control PORTC /**< Control port for segment D */ 42 | #define __7Seg_D_Config DDRC /**< Data direction register for segment D */ 43 | #define __7Seg_D_Pin 3 /**< Pin number for segment D */ 44 | 45 | /* Define control and configuration for segment E */ 46 | #define __7Seg_E_Control PORTD /**< Control port for segment E */ 47 | #define __7Seg_E_Config DDRD /**< Data direction register for segment E */ 48 | #define __7Seg_E_Pin 0 /**< Pin number for segment E */ 49 | 50 | /* Define control and configuration for segment F */ 51 | #define __7Seg_F_Control PORTD /**< Control port for segment F */ 52 | #define __7Seg_F_Config DDRD /**< Data direction register for segment F */ 53 | #define __7Seg_F_Pin 1 /**< Pin number for segment F */ 54 | 55 | /* Define control and configuration for segment G */ 56 | #define __7Seg_G_Control PORTD /**< Control port for segment G */ 57 | #define __7Seg_G_Config DDRD /**< Data direction register for segment G */ 58 | #define __7Seg_G_Pin 4 /**< Pin number for segment G */ 59 | 60 | /* Define control and configuration for decimal point (DP) */ 61 | #define __7Seg_DP_Control PORTD /**< Control port for the decimal point (DP) */ 62 | #define __7Seg_DP_Config DDRD /**< Data direction register for DP */ 63 | #define __7Seg_DP_Pin 7 /**< Pin number for the decimal point (DP) */ 64 | 65 | /* Define control and configuration for each digit */ 66 | #define __7Seg_Digit1_Control PORTB /**< Control port for Digit 1 */ 67 | #define __7Seg_Digit1_Config DDRB /**< Data direction register for Digit 1 */ 68 | #define __7Seg_Digit1_Pin 0 /**< Pin number for Digit 1 */ 69 | 70 | #define __7Seg_Digit2_Control PORTB /**< Control port for Digit 2 */ 71 | #define __7Seg_Digit2_Config DDRB /**< Data direction register for Digit 2 */ 72 | #define __7Seg_Digit2_Pin 1 /**< Pin number for Digit 2 */ 73 | 74 | #define __7Seg_Digit3_Control PORTB /**< Control port for Digit 3 */ 75 | #define __7Seg_Digit3_Config DDRB /**< Data direction register for Digit 3 */ 76 | #define __7Seg_Digit3_Pin 2 /**< Pin number for Digit 3 */ 77 | 78 | #define __7Seg_Digit4_Control PORTB /**< Control port for Digit 4 */ 79 | #define __7Seg_Digit4_Config DDRB /**< Data direction register for Digit 4 */ 80 | #define __7Seg_Digit4_Pin 4 /**< Pin number for Digit 4 */ 81 | 82 | /** 83 | * @brief Initializes the 7-segment display. 84 | * 85 | * This function configures the appropriate ports and pins for controlling the 7-segment display. 86 | * It sets the direction for each pin (input/output) and initializes the display for use. 87 | */ 88 | void Seg7_init(void); 89 | 90 | /** 91 | * @brief Displays a number on the 7-segment display. 92 | * 93 | * This function takes a 4-digit value (0-9999) and displays it on the 7-segment display using multiplexing. 94 | * It will handle sequentially displaying each digit with appropriate timing. 95 | * 96 | * @param _7SegValue The 4-digit number to be displayed on the 7-segment display. 97 | */ 98 | void Seg7_Puti(uint16_t _7SegValue); 99 | 100 | #endif 101 | -------------------------------------------------------------------------------- /Sources/Parallel Driver/Multiplexing/Seg7.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Seg7.c 3 | * @brief 7-segment display control library for AVR microcontrollers 4 | * @note This file provides functionality to control a 4-digit 7-segment display 5 | * using multiplexing for AVR microcontrollers. 6 | * 7 | * @author Your Name 8 | * @github Your GitHub Link 9 | * 10 | * @note For detailed explanations of this library, along with additional notes and examples of usage, 11 | * please visit the following repository: 12 | * https://github.com/aKaReZa75/AVR_7Segments 13 | */ 14 | 15 | #include "Seg7.h" 16 | 17 | /** 18 | * @brief Segment-to-segment mapping for 0-9 using Common Cathode configuration. 19 | * 20 | * This array holds the segment bit pattern for each digit (0-9) for a 7-segment display. 21 | */ 22 | const uint8_t Segments_Data[16] = 23 | { 24 | 0x3F, /**< 0 */ 25 | 0x06, /**< 1 */ 26 | 0x5B, /**< 2 */ 27 | 0x4F, /**< 3 */ 28 | 0x66, /**< 4 */ 29 | 0x6D, /**< 5 */ 30 | 0x7D, /**< 6 */ 31 | 0x07, /**< 7 */ 32 | 0x7F, /**< 8 */ 33 | 0x6F, /**< 9 */ 34 | 0x77, /**< A */ 35 | 0x7C, /**< b */ 36 | 0x39, /**< C */ 37 | 0x5E, /**< d */ 38 | 0x79, /**< E */ 39 | 0x71 /**< F */ 40 | }; 41 | 42 | /** 43 | * @brief Array to store the individual digits for the 4-digit display. 44 | * 45 | * This array holds the values of the individual digits (thousands, hundreds, tens, ones). 46 | */ 47 | uint8_t Segment[4] = {0, 0, 0, 0}; 48 | 49 | 50 | /** 51 | * @brief Initializes the 7-segment display. 52 | * 53 | * This function configures the control and data direction registers for all segments (A-G) 54 | * and digits (1-4) of the 7-segment display. 55 | * It sets each pin as an output to allow control of the display. 56 | */ 57 | void Seg7_init(void) 58 | { 59 | /* Configure all the control and segment pins as outputs */ 60 | GPIO_Config_OUTPUT(__7Seg_A_Config, __7Seg_A_Pin); 61 | GPIO_Config_OUTPUT(__7Seg_B_Config, __7Seg_B_Pin); 62 | GPIO_Config_OUTPUT(__7Seg_C_Config, __7Seg_C_Pin); 63 | GPIO_Config_OUTPUT(__7Seg_D_Config, __7Seg_D_Pin); 64 | GPIO_Config_OUTPUT(__7Seg_E_Config, __7Seg_E_Pin); 65 | GPIO_Config_OUTPUT(__7Seg_F_Config, __7Seg_F_Pin); 66 | GPIO_Config_OUTPUT(__7Seg_G_Config, __7Seg_G_Pin); 67 | GPIO_Config_OUTPUT(__7Seg_DP_Config, __7Seg_DP_Pin); 68 | GPIO_Config_OUTPUT(__7Seg_Digit1_Config, __7Seg_Digit1_Pin); 69 | GPIO_Config_OUTPUT(__7Seg_Digit2_Config, __7Seg_Digit2_Pin); 70 | GPIO_Config_OUTPUT(__7Seg_Digit3_Config, __7Seg_Digit3_Pin); 71 | GPIO_Config_OUTPUT(__7Seg_Digit4_Config, __7Seg_Digit4_Pin); 72 | 73 | /* Set control pins for digits as outputs */ 74 | GPIO_Config_OUTPUT(__7Seg_Digit1_Control, __7Seg_Digit1_Pin); 75 | GPIO_Config_OUTPUT(__7Seg_Digit2_Control, __7Seg_Digit2_Pin); 76 | GPIO_Config_OUTPUT(__7Seg_Digit3_Control, __7Seg_Digit3_Pin); 77 | GPIO_Config_OUTPUT(__7Seg_Digit4_Control, __7Seg_Digit4_Pin); 78 | } 79 | 80 | /** 81 | * @brief Displays a 4-digit number on the 7-segment display using multiplexing. 82 | * 83 | * This function displays a number on the 7-segment display by sequentially activating 84 | * each digit and lighting up the corresponding segments. The function uses multiplexing 85 | * to display all 4 digits in quick succession, creating the illusion that they are 86 | * all being shown at once. 87 | * 88 | * @param _7SegValue The 4-digit value (0-9999) to display on the 7-segment display. 89 | */ 90 | void Seg7_Puti(uint16_t _7SegValue) 91 | { 92 | static uint8_t _Digit = 0; /**< Variable to determine which digit to activate */ 93 | 94 | /* Extract digits (thousands to ones) from the 7-segment value */ 95 | Segment[3] = (_7SegValue % 10); /**< thousands (Digit4) */ 96 | _7SegValue /= 10; 97 | Segment[2] = (_7SegValue % 10); /**< hundreds (Digit3) */ 98 | _7SegValue /= 10; 99 | Segment[1] = (_7SegValue % 10); /**< tens (Digit2) */ 100 | _7SegValue /= 10; 101 | Segment[0] = (_7SegValue % 10); /**< ones (Digit1) */ 102 | 103 | /* Update the segments based on the current digit to display */ 104 | bitChange(__7Seg_A_Control, __7Seg_A_Pin, bitCheck(Segments_Data[Segment[_Digit]], 0)); 105 | bitChange(__7Seg_B_Control, __7Seg_B_Pin, bitCheck(Segments_Data[Segment[_Digit]], 1)); 106 | bitChange(__7Seg_C_Control, __7Seg_C_Pin, bitCheck(Segments_Data[Segment[_Digit]], 2)); 107 | bitChange(__7Seg_D_Control, __7Seg_D_Pin, bitCheck(Segments_Data[Segment[_Digit]], 3)); 108 | bitChange(__7Seg_E_Control, __7Seg_E_Pin, bitCheck(Segments_Data[Segment[_Digit]], 4)); 109 | bitChange(__7Seg_F_Control, __7Seg_F_Pin, bitCheck(Segments_Data[Segment[_Digit]], 5)); 110 | bitChange(__7Seg_G_Control, __7Seg_G_Pin, bitCheck(Segments_Data[Segment[_Digit]], 6)); 111 | 112 | /* Activate the corresponding digit */ 113 | bitChange(__7Seg_Digit1_Control, __7Seg_Digit1_Pin, bitCheck((1<<_Digit), 0)); 114 | bitChange(__7Seg_Digit2_Control, __7Seg_Digit2_Pin, bitCheck((1<<_Digit), 1)); 115 | bitChange(__7Seg_Digit3_Control, __7Seg_Digit3_Pin, bitCheck((1<<_Digit), 2)); 116 | bitChange(__7Seg_Digit4_Control, __7Seg_Digit4_Pin, bitCheck((1<<_Digit), 3)); 117 | 118 | /* Increment the _Digit and reset if necessary */ 119 | _Digit++; 120 | if (_Digit == 4) 121 | { 122 | _Digit = 0; 123 | }; 124 | }; 125 | -------------------------------------------------------------------------------- /Sources/Parallel Driver/Multiplexing/Examples/4Digit_CC_Delay/src/Seg7.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Seg7.c 3 | * @brief 7-segment display control library for AVR microcontrollers 4 | * @note This file provides functionality to control a 4-digit 7-segment display 5 | * using multiplexing for AVR microcontrollers. 6 | * 7 | * @author Your Name 8 | * @github Your GitHub Link 9 | * 10 | * @note For detailed explanations of this library, along with additional notes and examples of usage, 11 | * please visit the following repository: 12 | * https://github.com/aKaReZa75/AVR_7Segments 13 | */ 14 | 15 | #include "Seg7.h" 16 | 17 | /** 18 | * @brief Segment-to-segment mapping for 0-9 using Common Cathode configuration. 19 | * 20 | * This array holds the segment bit pattern for each digit (0-9) for a 7-segment display. 21 | */ 22 | const uint8_t Segments_Data[16] = 23 | { 24 | 0x3F, /**< 0 */ 25 | 0x06, /**< 1 */ 26 | 0x5B, /**< 2 */ 27 | 0x4F, /**< 3 */ 28 | 0x66, /**< 4 */ 29 | 0x6D, /**< 5 */ 30 | 0x7D, /**< 6 */ 31 | 0x07, /**< 7 */ 32 | 0x7F, /**< 8 */ 33 | 0x6F, /**< 9 */ 34 | 0x77, /**< A */ 35 | 0x7C, /**< b */ 36 | 0x39, /**< C */ 37 | 0x5E, /**< d */ 38 | 0x79, /**< E */ 39 | 0x71 /**< F */ 40 | }; 41 | 42 | /** 43 | * @brief Array to store the individual digits for the 4-digit display. 44 | * 45 | * This array holds the values of the individual digits (thousands, hundreds, tens, ones). 46 | */ 47 | uint8_t Segment[4] = {0, 0, 0, 0}; 48 | 49 | 50 | /** 51 | * @brief Initializes the 7-segment display. 52 | * 53 | * This function configures the control and data direction registers for all segments (A-G) 54 | * and digits (1-4) of the 7-segment display. 55 | * It sets each pin as an output to allow control of the display. 56 | */ 57 | void Seg7_init(void) 58 | { 59 | /* Configure all the control and segment pins as outputs */ 60 | GPIO_Config_OUTPUT(__7Seg_A_Config, __7Seg_A_Pin); 61 | GPIO_Config_OUTPUT(__7Seg_B_Config, __7Seg_B_Pin); 62 | GPIO_Config_OUTPUT(__7Seg_C_Config, __7Seg_C_Pin); 63 | GPIO_Config_OUTPUT(__7Seg_D_Config, __7Seg_D_Pin); 64 | GPIO_Config_OUTPUT(__7Seg_E_Config, __7Seg_E_Pin); 65 | GPIO_Config_OUTPUT(__7Seg_F_Config, __7Seg_F_Pin); 66 | GPIO_Config_OUTPUT(__7Seg_G_Config, __7Seg_G_Pin); 67 | GPIO_Config_OUTPUT(__7Seg_DP_Config, __7Seg_DP_Pin); 68 | GPIO_Config_OUTPUT(__7Seg_Digit1_Config, __7Seg_Digit1_Pin); 69 | GPIO_Config_OUTPUT(__7Seg_Digit2_Config, __7Seg_Digit2_Pin); 70 | GPIO_Config_OUTPUT(__7Seg_Digit3_Config, __7Seg_Digit3_Pin); 71 | GPIO_Config_OUTPUT(__7Seg_Digit4_Config, __7Seg_Digit4_Pin); 72 | 73 | /* Set control pins for digits as outputs */ 74 | GPIO_Config_OUTPUT(__7Seg_Digit1_Control, __7Seg_Digit1_Pin); 75 | GPIO_Config_OUTPUT(__7Seg_Digit2_Control, __7Seg_Digit2_Pin); 76 | GPIO_Config_OUTPUT(__7Seg_Digit3_Control, __7Seg_Digit3_Pin); 77 | GPIO_Config_OUTPUT(__7Seg_Digit4_Control, __7Seg_Digit4_Pin); 78 | } 79 | 80 | /** 81 | * @brief Displays a 4-digit number on the 7-segment display using multiplexing. 82 | * 83 | * This function displays a number on the 7-segment display by sequentially activating 84 | * each digit and lighting up the corresponding segments. The function uses multiplexing 85 | * to display all 4 digits in quick succession, creating the illusion that they are 86 | * all being shown at once. 87 | * 88 | * @param _7SegValue The 4-digit value (0-9999) to display on the 7-segment display. 89 | */ 90 | void Seg7_Puti(uint16_t _7SegValue) 91 | { 92 | static uint8_t _Digit = 0; /**< Variable to determine which digit to activate */ 93 | 94 | /* Extract digits (thousands to ones) from the 7-segment value */ 95 | Segment[3] = (_7SegValue % 10); /**< thousands (Digit4) */ 96 | _7SegValue /= 10; 97 | Segment[2] = (_7SegValue % 10); /**< hundreds (Digit3) */ 98 | _7SegValue /= 10; 99 | Segment[1] = (_7SegValue % 10); /**< tens (Digit2) */ 100 | _7SegValue /= 10; 101 | Segment[0] = (_7SegValue % 10); /**< ones (Digit1) */ 102 | 103 | /* Update the segments based on the current digit to display */ 104 | bitChange(__7Seg_A_Control, __7Seg_A_Pin, bitCheck(Segments_Data[Segment[_Digit]], 0)); 105 | bitChange(__7Seg_B_Control, __7Seg_B_Pin, bitCheck(Segments_Data[Segment[_Digit]], 1)); 106 | bitChange(__7Seg_C_Control, __7Seg_C_Pin, bitCheck(Segments_Data[Segment[_Digit]], 2)); 107 | bitChange(__7Seg_D_Control, __7Seg_D_Pin, bitCheck(Segments_Data[Segment[_Digit]], 3)); 108 | bitChange(__7Seg_E_Control, __7Seg_E_Pin, bitCheck(Segments_Data[Segment[_Digit]], 4)); 109 | bitChange(__7Seg_F_Control, __7Seg_F_Pin, bitCheck(Segments_Data[Segment[_Digit]], 5)); 110 | bitChange(__7Seg_G_Control, __7Seg_G_Pin, bitCheck(Segments_Data[Segment[_Digit]], 6)); 111 | 112 | /* Activate the corresponding digit */ 113 | bitChange(__7Seg_Digit1_Control, __7Seg_Digit1_Pin, bitCheck((1<<_Digit), 0)); 114 | bitChange(__7Seg_Digit2_Control, __7Seg_Digit2_Pin, bitCheck((1<<_Digit), 1)); 115 | bitChange(__7Seg_Digit3_Control, __7Seg_Digit3_Pin, bitCheck((1<<_Digit), 2)); 116 | bitChange(__7Seg_Digit4_Control, __7Seg_Digit4_Pin, bitCheck((1<<_Digit), 3)); 117 | 118 | /* Increment the _Digit and reset if necessary */ 119 | _Digit++; 120 | if (_Digit == 4) 121 | { 122 | _Digit = 0; 123 | }; 124 | }; 125 | -------------------------------------------------------------------------------- /Basics.md: -------------------------------------------------------------------------------- 1 | ## How a 7-Segment Display Works 2 | A 7-segment display has 7 individual LEDs arranged in the form of a figure-eight. The following is a representation of the segments: 3 | 4 | ``` 5 | A 6 | ----- 7 | F| |B 8 | --G-- 9 | E| |C 10 | ----- 11 | D 12 | ``` 13 | 14 | Each segment can be turned on or off, and by doing so in different combinations, you can display numbers or letters. For example, to display the number '1', you would turn on segments B and C, and leave the rest off. To display the number '8', all segments (A-G) would be turned on. 15 | 16 | ### Common Cathode vs. Common Anode 17 | 18 | There are two types of 7-segment displays: **common cathode** and **common anode**. 19 | 20 | - **Common Cathode**: In a common cathode display, all the cathodes (negative side) of the individual segments are connected together and are typically connected to ground (GND). Each segment is controlled by applying a HIGH signal to the corresponding anode (positive side). The segments light up when a HIGH signal is applied. 21 | 22 | - **Common Anode**: In a common anode display, all the anodes (positive side) of the individual segments are connected together and are typically connected to the VCC (positive voltage). Each segment is controlled by applying a LOW signal to the corresponding cathode (negative side). The segments light up when a LOW signal is applied. 23 | 24 | In both cases, each individual segment is represented by a pin, and by controlling these pins, you can display numbers. The only difference between common anode and common cathode displays is the polarity of the voltage applied to the segments. 25 | 26 | #### Example of Segment Control for Common Cathode: 27 | To display the number '3', the required segments are A, B, C, D, and G. In a common cathode configuration: 28 | - Apply a HIGH signal to segments A, B, C, D, and G. 29 | - The other segments (E, F) remain off. 30 | 31 | #### Example of Segment Control for Common Anode: 32 | To display the number '3', the required segments are A, B, C, D, and G. In a common anode configuration: 33 | - Apply a LOW signal to segments A, B, C, D, and G. 34 | - The other segments (E, F) remain off. 35 | 36 | ### 7-Segment Display Segment Control (Hexadecimal Format) 37 | 38 | | Digit | A | B | C | D | E | F | G | Common Cathode (Active HIGH) | Common Anode (Active LOW) | 39 | |-------|-----|-----|-----|-----|-----|-----|-----|------------------------------|---------------------------| 40 | | **0** | ON | ON | ON | ON | ON | ON | OFF | 0b00111111 → **0x3F** | 0b11000000 → **0xC0** | 41 | | **1** | OFF | ON | ON | OFF | OFF | OFF | OFF | 0b00000110 → **0x06** | 0b11111001 → **0xF9** | 42 | | **2** | ON | ON | OFF | ON | ON | OFF | ON | 0b01011011 → **0x5B** | 0b10100100 → **0xA4** | 43 | | **3** | ON | ON | ON | ON | OFF | OFF | ON | 0b01001111 → **0x4F** | 0b10110000 → **0xB0** | 44 | | **4** | OFF | ON | ON | OFF | OFF | ON | ON | 0b01100110 → **0x66** | 0b10011001 → **0x99** | 45 | | **5** | ON | OFF | ON | ON | OFF | ON | ON | 0b01101101 → **0x6D** | 0b10010010 → **0x92** | 46 | | **6** | ON | OFF | ON | ON | ON | ON | ON | 0b01111101 → **0x7D** | 0b10000010 → **0x82** | 47 | | **7** | ON | ON | ON | OFF | OFF | OFF | OFF | 0b00000111 → **0x07** | 0b11111000 → **0xF8** | 48 | | **8** | ON | ON | ON | ON | ON | ON | ON | 0b01111111 → **0x7F** | 0b10000000 → **0x80** | 49 | | **9** | ON | ON | ON | ON | OFF | ON | ON | 0b01101111 → **0x6F** | 0b10010000 → **0x90** | 50 | | **A** | ON | ON | ON | OFF | ON | ON | ON | 0b01110111 → **0x77** | 0b10001000 → **0x88** | 51 | | **B** | OFF | OFF | ON | ON | ON | ON | ON | 0b01111100 → **0x7C** | 0b10000011 → **0x83** | 52 | | **C** | ON | OFF | OFF | ON | ON | ON | OFF | 0b00111001 → **0x39** | 0b11000110 → **0xC6** | 53 | | **D** | OFF | ON | ON | ON | ON | OFF | ON | 0b01011110 → **0x5E** | 0b10100001 → **0xA1** | 54 | | **E** | ON | OFF | OFF | ON | ON | ON | ON | 0b01111001 → **0x79** | 0b10000110 → **0x86** | 55 | | **F** | ON | OFF | OFF | OFF | ON | ON | ON | 0b01110001 → **0x71** | 0b10001110 → **0x8E** | 56 | 57 | 58 | #### Explanation: 59 | - **A, B, C, D, E, F, G** represent the segments of the 7-segment display. 60 | 61 | - **Common Cathode**: 62 | - In a **common cathode** configuration, a **HIGH** signal turns on the segment. 63 | - The hexadecimal values are based on this configuration, where the bits represent which segments are on (1) or off (0). 64 | 65 | - **Common Anode**: 66 | - In a **common anode** configuration, a **LOW** signal turns on the segment. 67 | - The hexadecimal values for this configuration are inverted compared to the common cathode because the logic is reversed. 68 | 69 | 70 | ```c 71 | /* Common Cathode (Active HIGH - segments light when bit = 1) */ 72 | const uint8_t Seg7_cc[16] = 73 | { 74 | 0x3F, /**< 0: ABCDEF (0b00111111) */ 75 | 0x06, /**< 1: BC (0b00000110) */ 76 | 0x5B, /**< 2: ABDEG (0b01011011) */ 77 | 0x4F, /**< 3: ABCDG (0b01001111) */ 78 | 0x66, /**< 4: BCFG (0b01100110) */ 79 | 0x6D, /**< 5: ACDFG (0b01101101) */ 80 | 0x7D, /**< 6: ACDEFG (0b01111101) */ 81 | 0x07, /**< 7: ABC (0b00000111) */ 82 | 0x7F, /**< 8: ABCDEFG (0b01111111) */ 83 | 0x6F, /**< 9: ABCDFG (0b01101111) */ 84 | 0x77, /**< A: ABCEFG (0b01110111) */ 85 | 0x7C, /**< B: CDEFG (0b01111100) */ 86 | 0x39, /**< C: ADEF (0b00111001) */ 87 | 0x5E, /**< D: BCDEG (0b01011110) */ 88 | 0x79, /**< E: ADEFG (0b01111001) */ 89 | 0x71 /**< F: AEFG (0b01110001) */ 90 | }; 91 | 92 | /* Common Anode (Active LOW - segments light when bit = 0) */ 93 | const uint8_t Seg7_ca[16] = 94 | { 95 | 0xC0, /**< 0: ABCDEF (0b11000000) */ 96 | 0xF9, /**< 1: BC (0b11111001) */ 97 | 0xA4, /**< 2: ABDEG (0b10100100) */ 98 | 0xB0, /**< 3: ABCDG (0b10110000) */ 99 | 0x99, /**< 4: BCFG (0b10011001) */ 100 | 0x92, /**< 5: ACDFG (0b10010010) */ 101 | 0x82, /**< 6: ACDEFG (0b10000010) */ 102 | 0xF8, /**< 7: ABC (0b11111000) */ 103 | 0x80, /**< 8: ABCDEFG (0b10000000) */ 104 | 0x90, /**< 9: ABCDFG (0b10010000) */ 105 | 0x88, /**< A: ABCEFG (0b10001000) */ 106 | 0x83, /**< B: CDEFG (0b10000011) */ 107 | 0xC6, /**< C: ADEF (0b11000110) */ 108 | 0xA1, /**< D: BCDEG (0b10100001) */ 109 | 0x86, /**< E: ADEFG (0b10000110) */ 110 | 0x8E /**< F: AEFG (0b10001110) */ 111 | }; 112 | ``` 113 | 114 | ```c 115 | /* Common Cathode (Hex values for digits 0–15) */ 116 | const uint8_t Seg7_cc[16] = {0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F, 0x77, 0x7C, 0x39, 0x5E, 0x79, 0x71}; 117 | 118 | /* Common Anode (Hex values for digits 0–15) */ 119 | const uint8_t Seg7_ca[16] = {0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8, 0x80, 0x90, 0x88, 0x83, 0xC6, 0xA1, 0x86, 0x8E}; 120 | 121 | ``` 122 | 123 | # 🌟 Support Me 124 | If you found this repository useful: 125 | - Subscribe to my [YouTube Channel](https://www.youtube.com/@aKaReZa75). 126 | - Share this repository with others. 127 | - Give this repository and my other repositories a star. 128 | - Follow my [GitHub account](https://github.com/aKaReZa75). 129 | 130 | # ✉️ Contact Me 131 | Feel free to reach out to me through any of the following platforms: 132 | - 📧 [Email: aKaReZa75@gmail.com](mailto:aKaReZa75@gmail.com) 133 | - 🎥 [YouTube: @aKaReZa75](https://www.youtube.com/@aKaReZa75) 134 | - 💼 [LinkedIn: @akareza75](https://www.linkedin.com/in/akareza75) 135 | -------------------------------------------------------------------------------- /API_Reference.md: -------------------------------------------------------------------------------- 1 | ## API Reference 2 | 3 | The following API functions are designed to help with controlling 7-segment displays on the ATMEGA328 microcontroller. 4 | 5 | > [!NOTE] 6 | > The library and all of its APIs provided below have been developed by myself. 7 | This library utilizes various macros defined in the `aKaReZa.h` header file, which are designed to simplify bitwise operations and register manipulations. 8 | Detailed descriptions of these macros can be found at the following link: 9 | > [https://github.com/aKaReZa75/AVR/blob/main/Macros.md](https://github.com/aKaReZa75/AVR/blob/main/Macros.md) 10 | 11 | 12 | ### Flexible Pin Assignment 13 | This library allows you to easily control 7-segment displays, and it is designed with flexibility in mind. Each segment of the 7-segment display (A through G) can be connected to any available pin of the ATMEGA328 microcontroller. This flexibility is crucial because it allows you to customize the pin connections based on your design needs, without being restricted by predefined hardware mappings. 14 | 15 | To make pin configuration easier and more manageable, the `Seg7.h` header file defines a set of macros that allow the user to specify which microcontroller pins should be used for each segment and digit control. This means that each segment (A, B, C, D, E, F, G, and the DP) can be assigned to any GPIO pin of the ATMEGA328. 16 | 17 | ### Example Pin Configuration 18 | In the `Seg7.h` header file, you'll find a set of macros that define the pin assignments for the 7-segment display. These macros are set to specific pins by default, but you can easily change them to any other pin on the microcontroller. For instance, the default configuration may look like this: 19 | 20 | > [!NOTE] 21 | These default pin assignments are based on the pin configuration for the 7-segment shield, as found in the [7Segment Shield](https://github.com/aKaReZa75/eBoard_7Segments) repository. 22 | 23 | ```c 24 | #define _7Seg_A_Control PORTC 25 | #define _7Seg_A_Config DDRC 26 | #define _7Seg_A_Pin 0 27 | 28 | #define _7Seg_B_Control PORTC 29 | #define _7Seg_B_Config DDRC 30 | #define _7Seg_B_Pin 1 31 | 32 | #define _7Seg_C_Control PORTC 33 | #define _7Seg_C_Config DDRC 34 | #define _7Seg_C_Pin 2 35 | 36 | #define _7Seg_D_Control PORTC 37 | #define _7Seg_D_Config DDRC 38 | #define _7Seg_D_Pin 3 39 | 40 | #define _7Seg_E_Control PORTD 41 | #define _7Seg_E_Config DDRD 42 | #define _7Seg_E_Pin 0 43 | 44 | #define _7Seg_F_Control PORTD 45 | #define _7Seg_F_Config DDRD 46 | #define _7Seg_F_Pin 1 47 | 48 | #define _7Seg_G_Control PORTD 49 | #define _7Seg_G_Config DDRD 50 | #define _7Seg_G_Pin 4 51 | 52 | #define _7Seg_DP_Control PORTD 53 | #define _7Seg_DP_Config DDRD 54 | #define _7Seg_DP_Pin 7 55 | 56 | #define _7Seg_Digit1_Control PORTB 57 | #define _7Seg_Digit1_Config DDRB 58 | #define _7Seg_Digit1_Pin 0 59 | 60 | #define _7Seg_Digit2_Control PORTB 61 | #define _7Seg_Digit2_Config DDRB 62 | #define _7Seg_Digit2_Pin 1 63 | 64 | #define _7Seg_Digit3_Control PORTB 65 | #define _7Seg_Digit3_Config DDRB 66 | #define _7Seg_Digit3_Pin 2 67 | 68 | #define _7Seg_Digit4_Control PORTB 69 | #define _7Seg_Digit4_Config DDRB 70 | #define _7Seg_Digit4_Pin 4 71 | ``` 72 | 73 | #### How It Works 74 | - The macros defined in the `Seg7.h` file specify which microcontroller pins are used for each segment and each digit of the 7-segment display. 75 | - For example: 76 | - `_7Seg_A_Control` and `_7Seg_A_Pin` correspond to the control port (PORTC) and pin (pin 0) for segment A. 77 | - Similarly, `_7Seg_B_Control` and `_7Seg_B_Pin` define the port and pin for segment B, and so on for the remaining segments and digits. 78 | 79 | - By using these macros, you can configure each segment and each digit of the display to any port and pin you choose, just by modifying the macro definitions. This flexibility allows you to adapt the code to your specific hardware setup, making it ideal for a wide range of projects. 80 | 81 | For example, if you want to change the pin for segment A to pin 5 of PORTB, you can modify the macro like this: 82 | 83 | ```c 84 | #define _7Seg_A_Control PORTB 85 | #define _7Seg_A_Config DDRB 86 | #define _7Seg_A_Pin 5 87 | ``` 88 | 89 | This allows you to control which pins are connected to each segment, ensuring that you have full control over your display setup. 90 | 91 | ### **Initialization** 92 | ```c 93 | void Seg7_init(void); 94 | ``` 95 | * Initializes the 7-segment display configuration. 96 | * This function sets the appropriate pin directions for controlling the segments and digits of the 7-segment display. 97 | * It configures all the necessary pins as output. 98 | 99 | **Default Configuration** 100 | 101 | | **Segment/Digit** | **Control Port & Pin** | 102 | |---------------------------|--------------------------| 103 | | **Type of 7-Segment** | Common Cathode | 104 | | **Number of Digits** | 4 | 105 | | **Segment A** | PORTC, Pin 0 | 106 | | **Segment B** | PORTC, Pin 1 | 107 | | **Segment C** | PORTC, Pin 2 | 108 | | **Segment D** | PORTC, Pin 3 | 109 | | **Segment E** | PORTD, Pin 0 | 110 | | **Segment F** | PORTD, Pin 1 | 111 | | **Segment G** | PORTD, Pin 4 | 112 | | **Decimal Point (DP)** | PORTD, Pin 7 | 113 | | **Digit 1 (Thousands)** | PORTB, Pin 0 | 114 | | **Digit 2 (Hundreds)** | PORTB, Pin 1 | 115 | | **Digit 3 (Tens)** | PORTB, Pin 2 | 116 | | **Digit 4 (Ones)** | PORTB, Pin 4 | 117 | 118 | **Example:** 119 | ```c 120 | #include "aKaReZa.h" 121 | #include "Seg7.h" 122 | 123 | int main(void) 124 | { 125 | Seg7_init(); /**< Initialize the 7-segment display */ 126 | while(1) 127 | { 128 | /* Your code here to display values */ 129 | } 130 | } 131 | ``` 132 | 133 | ### **Display Number** 134 | ```c 135 | void Seg7_Puti(uint16_t _7SegValue); 136 | ``` 137 | * Displays a 4-digit number on the multiplexed 7-segment display. 138 | * This function uses multiplexing to display the digits sequentially with a short delay between each to simulate continuous display of the 4-digit value. 139 | * It will handle turning on the correct segments for each digit. 140 | 141 | > [!IMPORTANT] 142 | Currently, only **positive integers** between **0 and 9999** can be displayed. 143 | Additionally, only a **4-digit 7-segment display** is supported at the moment. 144 | 145 | 146 | **Example:** 147 | ```c 148 | #include "aKaReZa.h" 149 | #include "Seg7.h" 150 | 151 | int main(void) 152 | { 153 | Seg7_init(); /**< Initialize the 7-segment display */ 154 | while(1) 155 | { 156 | Seg7_Puti(1234); /**< Display the number 1234 */ 157 | } 158 | } 159 | ``` 160 | 161 | > [!CAUTION] 162 | For continuous display, the `Seg7_Puti` function needs to be executed continuously. 163 | It is recommended to use a **timer** to trigger the execution of the function at a fixed interval. 164 | This will prevent delays in the main program loop and ensure smoother performance by automating the multiplexing refresh. 165 | 166 | ## Summary 167 | 168 | Here’s a quick summary of the available functions: 169 | 170 | | Function Name | Description | 171 | |----------------------|--------------------------------------------------| 172 | | `Seg7_init()` | Initializes the 7-segment display configuration. | 173 | | `Seg7_Puti(uint16_t)` | Displays a 4-digit value on the multiplexed 7-segment display. | 174 | 175 | ## Complete Example 176 | 177 | The following example demonstrates how to initialize the 7-segment display, display a 4-digit number using multiplexing, and use a timer interrupt to update the display continuously. 178 | 179 | ```c 180 | #include "aKaReZa.h" 181 | #include "Seg7.h" 182 | 183 | /* Timer0 Overflow Interrupt Service Routine (ISR) */ 184 | ISR(TIMER0_OVF_vect) 185 | { 186 | Seg7_Puti(1234); /* Update the 7-segment display */ 187 | }; 188 | 189 | int main(void) 190 | { 191 | Seg7_init(); /**< Initialize the 7-segment display */ 192 | 193 | Timer0_Init(Initialize); /**< Initialize Timer0 for periodic updates */ 194 | 195 | globalInt_Enable(); /**< Enable global interrupts */ 196 | 197 | while(1) 198 | { 199 | /* Main loop can be used for other tasks, the display will update automatically via Timer0 interrupt */ 200 | }; 201 | }; 202 | ``` 203 | 204 | ### Explanation: 205 | 206 | In this example, the 7-Segments will be updated continuously at the specified interval (1ms in this case) due to the timer interrupt. 207 | 208 | ## Important Notes 209 | 210 | - **Multiplexing**: The 7-segment display operates using multiplexing, meaning each digit is displayed sequentially for a short period. This creates the illusion that all digits are visible at once. Ensure that the refresh rate is set appropriately to avoid flickering. 211 | - **Power Consumption**: Be cautious about power consumption when driving multiple 7-segment displays, as this can draw significant current. 212 | - **Pin Configuration**: Make sure the correct pins are defined in the header file. If you modify the microcontroller's pin configuration or use different segments, update the pin assignments accordingly. 213 | - **Delay Timing**: If the delay between digit switching is too short, the display may become unreadable. If it’s too long, the display might appear sluggish. 214 | - **Initialization**: Don’t forget to initialize the 7-segment display by calling `Seg7_init()`. 215 | - **Wiring Issues**: Ensure that the segments and common cathodes/anodes are wired correctly. 216 | - **Low Refresh Rate**: A refresh rate below 50 Hz may cause visible flickering, making the display hard to read. 217 | 218 | # 🌟 Support Me 219 | If you found this repository useful: 220 | - Subscribe to my [YouTube Channel](https://www.youtube.com/@aKaReZa75). 221 | - Share this repository with others. 222 | - Give this repository and my other repositories a star. 223 | - Follow my [GitHub account](https://github.com/aKaReZa75). 224 | 225 | # ✉️ Contact Me 226 | Feel free to reach out to me through any of the following platforms: 227 | - 📧 [Email: aKaReZa75@gmail.com](mailto:aKaReZa75@gmail.com) 228 | - 🎥 [YouTube: @aKaReZa75](https://www.youtube.com/@aKaReZa75) 229 | - 💼 [LinkedIn: @akareza75](https://www.linkedin.com/in/akareza75) 230 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 7-Segment Display with AVR Microcontrollers 2 | 3 | A 7-segment display is an electronic display device used to represent numbers, letters, and sometimes other characters. It consists of seven LEDs arranged in a specific way that can be turned on or off to form different digits or characters. The display has 7 segments (labeled A to G) and an optional decimal point (DP). By turning different combinations of these segments on or off, it is possible to represent all the digits from 0 to 9, and in some cases, letters like A, b, C, etc. 4 | 5 | 6 | 7 | 16 | 23 | 24 | 25 | 26 | 27 | 36 | 43 | 44 | 45 | 46 | 47 | 53 | 54 |
8 | 9 | > [!TIP] 10 | > If you're looking to better understand how to navigate and use my GitHub repositories — including exploring their structure, downloading or cloning projects, submitting issues, and asking questions, 11 | > everything you need is clearly explained in this video: 12 | > [aKaReZa 95 - Programming, Git - PART B](https://youtu.be/zYiUItVFRqQ) 13 | > Make sure to check it out! 14 | 15 | 17 | 18 | aKaReZa 95 - Programming, Git - PART B Thumbnail 21 | 22 |
28 | 29 | > [!IMPORTANT] 30 | > Begin your embedded systems journey with clarity and purpose. This episode outlines a structured roadmap for mastering microcontrollers, communication protocols, hardware design, and project development. 31 | > Learn how to choose your specialization, follow curated playlists, and engage effectively with the community—ideal for learners seeking a scalable, goal-driven path into embedded engineering. 32 | > [aKaReZa 124 – Embedded Systems Roadmap](https://youtu.be/3QYfv7A7aMc) 33 | > Watch it now to kickstart your journey! 34 | 35 | 37 | 38 | aKaReZa 124 – Embedded Systems Roadmap Thumbnail 41 | 42 |
48 | 49 | > [!CAUTION] 50 | > It is absolutely critical that you carefully read every single word of this document, line by line, to ensure you don't miss any details. Nothing can be overlooked. 51 | 52 |
55 | 56 | # 🔗 Resources 57 | Here you'll find a collection of useful links and videos related to the topic of AVR microcontrollers. 58 | 59 | 60 | ``` 61 | 7-Segment Display Overview 62 | ├── Basics 63 | │ ├─ Segment arrangement (A–G) 64 | │ ├─ Digit/letter segment combinations 65 | │ ├─ Common Cathode — wiring & logic 66 | │ ├─ Common Anode — wiring & logic 67 | │ └─ Hex code tables (0–F) + examples 68 | │ 69 | ├── Multiplexing 70 | │ ├─ Multiplexing concept 71 | │ ├─ Wiring for digit commons 72 | │ ├─ Refresh rate requirements 73 | │ ├─ Timing calculations 74 | │ └─ Example — 4-digit switching sequence 75 | │ 76 | └── API Reference 77 | ├─ CC_Hex_Array — 0–F hex values 78 | ├─ CA_Hex_Array — 0–F hex values 79 | └─ Multiplex_Example — sample C code 80 | ``` 81 | 82 | > [!TIP] 83 | > The resources are detailed in the sections below. 84 | > To access any of them, simply click on the corresponding blue link. 85 | 86 | - [Basics](./Basics.md) 87 | --- 88 | Covers segment arrangement (A–G), digit/letter combinations, common cathode vs. common anode wiring and logic, and hexadecimal segment code tables for digits 0–F. 89 | 90 | - [Multiplexing](./Multiplexing4Digit.md) 91 | --- 92 | Explains multiplexing operation for 4-digit displays, wiring of digit commons, refresh rate requirements, timing calculations, and example digit-switching sequence. 93 | 94 | - [API Reference](./API_Reference.md) 95 | --- 96 | Provides C arrays for common cathode and common anode hexadecimal values (0–F) and a sample C implementation for multiplexed 7-segment display control. 97 | 98 | ```plaintext 99 | AVR, 7Segment 100 | ├── [aKaReZa 44 - AVR, 7Segment - Part A] 101 | │ ├─ Display Setup — Driving common anode + 4-digit multiplexing. 102 | │ └─ Code Quality — Readability and structure tips. 103 | │ 104 | ├── [aKaReZa 47 - AVR, 7Segment - Part B] 105 | │ ├─ Buttons — Counter increment and input handling. 106 | │ ├─ Digit Split — Displaying digits individually. 107 | │ └─ Optimization — New macros for cleaner code. 108 | │ 109 | └── [aKaReZa 53 - AVR, 7Segment - Part C] 110 | ├─ Modularization — Functions and headers. 111 | ├─ Refresh Issue — Software-based fix. 112 | └─ Timer — Implementing 1-second Timer. 113 | ``` 114 | 115 | 116 | 117 | 125 | 132 | 133 | 134 | 135 | 143 | 150 | 151 | 152 | 153 | 161 | 168 | 169 |
118 |

119 | aKaReZa 44 – AVR, 7Segment - Part A 120 |

121 |

122 | Learn how to set up a common anode 7-segment display with an AVR microcontroller on a breadboard, and then multiplex a four-digit 7-segment display using a custom shield to improve code readability. 123 |

124 |
126 | 127 | aKaReZa 44 – AVR, 7Segment - Part A Thumbnail 130 | 131 |
136 |

137 | aKaReZa 47 – AVR, 7Segment - Part B 138 |

139 |

140 | Continuation of setting up 7-segment displays, building a counter, adding button functionality, displaying digits, optimizing code, and adding macros. 141 |

142 |
144 | 145 | aKaReZa 47 – AVR, 7Segment - Part B Thumbnail 148 | 149 |
154 |

155 | aKaReZa 53 – AVR, 7Segment - Part C 156 |

157 |

158 | Continuation of setting up 7-segment displays, addressing three software issues: modular code writing, display refresh during button press, and one-second counting. 159 |

160 |
162 | 163 | aKaReZa 53 – AVR, 7Segment - Part C Thumbnail 166 | 167 |
170 | 171 | 172 | > [!TIP] 173 | > The resources are detailed in the sections below. 174 | > To access any of them, simply click on the corresponding blue link. 175 | 176 | - [AVR Microntroller](https://github.com/aKaReZa75/AVR) 177 | --- 178 | This repository contains comprehensive resources for AVR microcontrollers, including hardware schematics, software libraries, and educational projects. 179 | 180 | # 💻 How to Use Git and GitHub 181 | To access the repository files and save them on your computer, there are two methods available: 182 | 1. **Using Git Bash and Cloning the Repository** 183 | - This method is more suitable for advanced users and those familiar with command-line tools. 184 | - By using this method, you can easily receive updates for the repository. 185 | 186 | 2. **Downloading the Repository as a ZIP file** 187 | - This method is simpler and suitable for users who are not comfortable with command-line tools. 188 | - Note that with this method, you will not automatically receive updates for the repository and will need to manually download any new updates. 189 | 190 | ## Clone using the URL. 191 | First, open **Git Bash** : 192 | - Open the folder in **File Explorer** where you want the library to be stored. 193 | - **Right-click** inside the folder and select the option **"Open Git Bash here"** to open **Git Bash** in that directory. 194 | 195 | ![open Git Bash](Images/Step0.png) 196 | 197 | > [!NOTE] 198 | > If you do not see the "Open Git Bash here" option, it means that Git is not installed on your system. 199 | > You can download and install Git from [this link](https://git-scm.com/downloads). 200 | > For a tutorial on how to install and use Git, check out [this video](https://youtu.be/BsykgHpmUt8). 201 | 202 | - Once **Git Bash** is open, run the following command to clone the repository: 203 | 204 | ```bash 205 | git clone https://github.com/aKaReZa75/AVR_7Segments.git 206 | ``` 207 | - You can copy the above command by either: 208 | - Clicking on the **Copy** button on the right of the command. 209 | - Or select the command text manually and press **Ctrl + C** to copy. 210 | - To paste the command into your **Git Bash** terminal, use **Shift + Insert**. 211 | 212 | ![Clone the Repository](Images/Step1.png) 213 | 214 | - Then, press Enter to start the cloning operation and wait for the success message to appear. 215 | 216 | ![Open the Library File](Images/Step2.png) 217 | 218 | > [!IMPORTANT] 219 | > Please keep in mind that the numbers displayed in the image might vary when you perform the same actions. 220 | > This is because repositories are continuously being updated and expanded. Nevertheless, the overall process remains unchanged. 221 | 222 | > [!NOTE] 223 | > Advantage of Cloning the Repository: 224 | > - **Receiving Updates:** By cloning the repository, you can easily and automatically receive new updates. 225 | > - **Version Control:** Using Git allows you to track changes and revert to previous versions. 226 | > - **Team Collaboration:** If you are working on a project with a team, you can easily sync changes from team members and collaborate more efficiently. 227 | 228 | ## Download Zip 229 | If you prefer not to use Git Bash or the command line, you can download the repository directly from GitHub as a ZIP file. 230 | Follow these steps: 231 | 1. Navigate to the GitHub repository page and Locate the Code button: 232 | - On the main page of the repository, you will see a green Code button near the top right corner. 233 | 234 | 2. Download the repository: 235 | - Click the Code button to open a dropdown menu. 236 | - Select Download ZIP from the menu. 237 | 238 | ![Download Zip](Images/Step7.png) 239 | 240 | 3. Save the ZIP file: 241 | - Choose a location on your computer to save the ZIP file and click Save. 242 | 243 | 4. Extract the ZIP file: 244 | - Navigate to the folder where you saved the ZIP file. 245 | - Right-click on the ZIP file and select Extract All... (Windows) or use your preferred extraction tool. 246 | - Choose a destination folder and extract the contents. 247 | 248 | 5. Access the repository: 249 | - Once extracted, you can access the repository files in the destination folder. 250 | 251 | > [!IMPORTANT] 252 | > - No Updates: Keep in mind that downloading the repository as a ZIP file does not allow you to receive updates. 253 | > If the repository is updated, you will need to download it again manually. 254 | > - Ease of Use: This method is simpler and suitable for users who are not comfortable with Git or command-line tools. 255 | 256 | # 📝 How to Ask Questions 257 | If you have any questions or issues, you can raise them through the **"Issues"** section of this repository. Here's how you can do it: 258 | 259 | 1. Navigate to the **"Issues"** tab at the top of the repository page. 260 | 261 | ![Issues](Images/Step3.png) 262 | 263 | 2. Click on the **"New Issue"** button. 264 | 265 | ![New Issue](Images/Step4.png) 266 | 267 | 3. In the **Title** field, write a short summary of your issue or question. 268 | 269 | 4. In the "Description" field, detail your question or issue as thoroughly as possible. You can use text formatting, attach files, and assign the issue to someone if needed. You can also use text formatting (like bullet points or code snippets) for better readability. 270 | 271 | 5. Optionally, you can add **labels**, **type**, **projects**, or **milestones** to your issue for better categorization. 272 | 273 | 6. Click on the **"Submit new issue"** button to post your question or issue. 274 | 275 | ![Submeet New Issue](Images/Step5.png) 276 | 277 | I will review and respond to your issue as soon as possible. Your participation helps improve the repository for everyone! 278 | 279 | > [!TIP] 280 | > - Before creating a new issue, please check the **"Closed"** section to see if your question has already been answered. 281 | > ![Closed section](Images/Step6.png) 282 | > - Write your question clearly and respectfully to ensure a faster and better response. 283 | > - While the examples provided above are in English, feel free to ask your questions in **Persian (فارسی)** as well. 284 | > - There is no difference in how they will be handled! 285 | 286 | > [!NOTE] 287 | > Pages and interfaces may change over time, but the steps to create an issue generally remain the same. 288 | 289 | # 🤝 Contributing to the Repository 290 | To contribute to this repository, please follow these steps: 291 | 1. **Fork the Repository** 292 | 2. **Clone the Forked Repository** 293 | 3. **Create a New Branch** 294 | 4. **Make Your Changes** 295 | 5. **Commit Your Changes** 296 | 6. **Push Your Changes to Your Forked Repository** 297 | 7. **Submit a Pull Request (PR)** 298 | 299 | > [!NOTE] 300 | > Please ensure your pull request includes a clear description of the changes you’ve made. 301 | > Once submitted, I will review your contribution and provide feedback if necessary. 302 | 303 | # 🌟 Support Me 304 | If you found this repository useful: 305 | - Subscribe to my [YouTube Channel](https://www.youtube.com/@aKaReZa75). 306 | - Share this repository with others. 307 | - Give this repository and my other repositories a star. 308 | - Follow my [GitHub account](https://github.com/aKaReZa75). 309 | 310 | # 📜 License 311 | This project is licensed under the GPL-3.0 License. This license grants you the freedom to use, modify, and distribute the project as long as you: 312 | - Credit the original authors: Give proper attribution to the original creators. 313 | - Disclose source code: If you distribute a modified version, you must make the source code available under the same GPL license. 314 | - Maintain the same license: When you distribute derivative works, they must be licensed under the GPL-3.0 too. 315 | - Feel free to use it in your projects, but make sure to comply with the terms of this license. 316 | 317 | # ✉️ Contact Me 318 | Feel free to reach out to me through any of the following platforms: 319 | - 📧 [Email: aKaReZa75@gmail.com](mailto:aKaReZa75@gmail.com) 320 | - 🎥 [YouTube: @aKaReZa75](https://www.youtube.com/@aKaReZa75) 321 | - 💼 [LinkedIn: @akareza75](https://www.linkedin.com/in/akareza75) 322 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------