{"id":2389,"date":"2024-03-14T08:36:30","date_gmt":"2024-03-14T08:36:30","guid":{"rendered":"https:\/\/blog.embeddedexpert.io\/?p=2389"},"modified":"2024-03-14T08:37:21","modified_gmt":"2024-03-14T08:37:21","slug":"working-with-stm32-and-displays-1-digit-7-segment-display","status":"publish","type":"post","link":"https:\/\/blog.embeddedexpert.io\/?p=2389","title":{"rendered":"Working with STM32 and Displays: 1-digit 7-segment display"},"content":{"rendered":"\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/03\/red-0.56inch-1-digit-7-segment-led-display-digital-tube-common-anode-1080x1080-1-1024x1024.png\" alt=\"\" class=\"wp-image-2390\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/03\/red-0.56inch-1-digit-7-segment-led-display-digital-tube-common-anode-1080x1080-1-1024x1024.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/03\/red-0.56inch-1-digit-7-segment-led-display-digital-tube-common-anode-1080x1080-1-300x300.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/03\/red-0.56inch-1-digit-7-segment-led-display-digital-tube-common-anode-1080x1080-1-150x150.png 150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/03\/red-0.56inch-1-digit-7-segment-led-display-digital-tube-common-anode-1080x1080-1-768x768.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/03\/red-0.56inch-1-digit-7-segment-led-display-digital-tube-common-anode-1080x1080-1-750x750.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/03\/red-0.56inch-1-digit-7-segment-led-display-digital-tube-common-anode-1080x1080-1-400x400.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/03\/red-0.56inch-1-digit-7-segment-led-display-digital-tube-common-anode-1080x1080-1-250x250.png 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/03\/red-0.56inch-1-digit-7-segment-led-display-digital-tube-common-anode-1080x1080-1.png 1080w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<p>In this guide, we shall see what is 7 segment display and the difference between Common anode and cathode.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>In this guide, we shall cover the following:<\/p>\n\n\n\n<p><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>What is 7 segment display.<\/li><li>Connection of common anode with STM32F4xx.<\/li><li>Driver.<\/li><li>Results.<\/li><\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. What is 7 Segment Display:<\/h2>\n\n\n\n<p>A&nbsp;<strong>7-segment display<\/strong>&nbsp;is an electronic display device used to show decimal numerals. It\u2019s an alternative to more complex dot matrix displays. Here are the key points about 7-segment displays:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li><strong>Structure<\/strong>:<ul><li>A 7-segment display consists of&nbsp;<strong>seven LEDs<\/strong>arranged in a rectangular fashion.<\/li><li>Each LED is called a&nbsp;<strong>segment<\/strong>&nbsp;because when illuminated, it forms part of a numerical digit (both decimal and hexadecimal) to be displayed.<\/li><li>An additional&nbsp;<strong>8th LED<\/strong>&nbsp;is sometimes included within the same package to indicate a decimal point (DP) when multiple 7-segment displays are connected together to display numbers greater than ten.<\/li><\/ul><\/li><li><strong>Working Principle<\/strong>:<ul><li>When the diode junction of each segment is&nbsp;<strong>forward biased<\/strong>&nbsp;by an external voltage, it allows current to flow across its junction, resulting in the emission of light.<\/li><li>The actual color of the visible light emitted by an LED (ranging from blue to red to orange) depends on the spectral wavelength of the emitted light, which itself is influenced by the mixture of impurities added to the semiconductor materials used to produce it.<\/li><\/ul><\/li><li><strong>Common Types<\/strong>:<ul><li>There are two common types of LED 7-segment displays:<ul><li><strong>Common Cathode (CC)<\/strong>: All cathodes of the 7-segments are connected directly together.<\/li><li><strong>Common Anode (CA)<\/strong>: All anodes of the 7-segments are connected together.<\/li><\/ul><\/li><\/ul><\/li><li><strong>Displaying Numbers<\/strong>:<ul><li>By forward biasing the appropriate pins of the LED segments in a specific order, some segments will be lit, while others remain dark.<\/li><li>This allows us to display each of the ten decimal digits (0 through 9) on the same 7-segment display.<\/li><\/ul><\/li><li><strong>Applications<\/strong>:<ul><li>7-segment displays are widely used in various devices, including:<ul><li><strong>Digital clocks<\/strong><\/li><li><strong>Electronic meters<\/strong><\/li><li><strong>Basic calculators<\/strong><\/li><\/ul><\/li><\/ul><\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"567\" height=\"333\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/03\/549766573_orig.jpg\" alt=\"\" class=\"wp-image-2391\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/03\/549766573_orig.jpg 567w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/03\/549766573_orig-300x176.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/03\/549766573_orig-400x235.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/03\/549766573_orig-250x147.jpg 250w\" sizes=\"(max-width: 567px) 100vw, 567px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. Connection of Common Anode with STM32F4xx:<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<p>The connection as following:<\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"750\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-14-at-10.57.41\u202fAM-1024x750.png\" alt=\"\" class=\"wp-image-2392\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-14-at-10.57.41\u202fAM-1024x750.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-14-at-10.57.41\u202fAM-300x220.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-14-at-10.57.41\u202fAM-768x562.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-14-at-10.57.41\u202fAM-1536x1124.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-14-at-10.57.41\u202fAM-2048x1499.png 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-14-at-10.57.41\u202fAM-1150x842.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-14-at-10.57.41\u202fAM-750x549.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-14-at-10.57.41\u202fAM-400x293.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2024\/03\/Screenshot-2024-03-14-at-10.57.41\u202fAM-250x183.png 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Connect A to G from the display to PC0 to PC6 on the STM32F4xx. Here, we don&#8217;t need the DP (Decimal Point).<\/p>\n\n\n\n<p>Connect the 3.3V through 220Ohm resistor to the Common anode. In case you have common cathode, connect the port to ground through 220Ohm resistor.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3. Developing the Driver:<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<p>Before heading into the driver, take a look at <a href=\"https:\/\/blog.embeddedexpert.io\/?p=1973\" data-type=\"URL\" data-id=\"https:\/\/blog.embeddedexpert.io\/?p=1973\" target=\"_blank\" rel=\"noreferrer noopener\">this guide<\/a> for how to configure the timer to generate DMA to control the GPIO.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>We start off by including the main STM32F4 header file as following:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">#include &quot;stm32f4xx.h&quot;<\/pre><\/div>\n\n\n\n<p>Since the size of the array to hold the number from 0 to 9 is 10, we shall create a macro for it as following:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">#define data_size \t10<\/pre><\/div>\n\n\n\n<p>For the DMA channel, it should be channel 6:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">#define CH6 \t\t0x06<\/pre><\/div>\n\n\n\n<p>Here, we are defining if we are using common anode or common cathode:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">#define COMMOM_ANODE 1<\/pre><\/div>\n\n\n\n<p>In case of common cathode, just define it as zero.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Here is the array to hold the state of the pins to display certain number:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">#if COMMOM_ANODE\n\n\nconst uint32_t seven_segment_lookup[] = {\n\n\t    0b11000000, \/\/ 0\n\t    0b11111001, \/\/ 1\n\t    0b10100100, \/\/ 2\n\t    0b10110000, \/\/ 3\n\t    0b10011001, \/\/ 4\n\t    0b10010010, \/\/ 5\n\t    0b10000010, \/\/ 6\n\t    0b11111000, \/\/ 7\n\t    0b10000000, \/\/ 8\n\t    0b10010000  \/\/ 9\n};\n\n#else\n\nconst uint32_t seven_segment_lookup[] = {\n\t    0b00111111, \/\/ 0\n\t    0b00000110, \/\/ 1\n\t    0b01011011, \/\/ 2\n\t    0b01001111, \/\/ 3\n\t    0b01100110, \/\/ 4\n\t    0b01101101, \/\/ 5\n\t    0b01111101, \/\/ 6\n\t    0b00000111, \/\/ 7\n\t    0b01111111, \/\/ 8\n\t    0b01101111  \/\/ 9\n\n};\n\n#endif<\/pre><\/div>\n\n\n\n<p>The rest of the code is similar to the parallel port emulation:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">int main(void)\n{\n\t\/*GPIO Configuration*\/\n\n\t\/*Enable clock access to GPIOA*\/\n\tRCC-&gt;AHB1ENR|=RCC_AHB1ENR_GPIOCEN;\n\n\t\/*Set PC0 to PC7 as output*\/\n\tGPIOC-&gt;MODER|=GPIO_MODER_MODE0_0|GPIO_MODER_MODE1_0|GPIO_MODER_MODE2_0\n\t\t\t|GPIO_MODER_MODE3_0|GPIO_MODER_MODE4_0|GPIO_MODER_MODE5_0|\n\t\t\tGPIO_MODER_MODE6_0|GPIO_MODER_MODE7_0;\n\n\tGPIOC-&gt;MODER&amp;=~(GPIO_MODER_MODE0_1|GPIO_MODER_MODE1_1|GPIO_MODER_MODE2_1\n\t\t\t|GPIO_MODER_MODE3_1|GPIO_MODER_MODE4_1|GPIO_MODER_MODE5_1\n\t\t\t|GPIO_MODER_MODE6_1|GPIO_MODER_MODE7_1);\n\n\n\n\t\/*Timer configuration*\/\n\n\tRCC-&gt;APB2ENR  |=  RCC_APB2ENR_TIM1EN;\n\n\tTIM1-&gt;DIER=TIM_DIER_UDE;\n\n\tTIM1-&gt;PSC=16000-1; \/*16 000 000 \/ 16 000 =1 000*\/\n\tTIM1-&gt;ARR=1000-1; \/*1 000 \/ 1 000 = 1HZ*\/\n\n\n\n\t\/*DMA configuration*\/\n\n\n\tRCC-&gt;AHB1ENR|=RCC_AHB1ENR_DMA2EN;\n\n\tDMA2_Stream5-&gt;CR&amp;=DMA_SxCR_EN;\n\n\twhile((DMA2_Stream5-&gt;CR)&amp;DMA_SxCR_EN){;}\n\n\tDMA2_Stream5-&gt;CR|=(CH6&lt;&lt;DMA_SxCR_CHSEL_Pos)|DMA_SxCR_MSIZE|DMA_SxCR_PSIZE|\n\t\t\tDMA_SxCR_MINC|DMA_SxCR_CIRC|DMA_SxCR_DIR_0;\n\n\tDMA2_Stream5-&gt;NDTR=(uint32_t)data_size;\n\n\tDMA2_Stream5-&gt;PAR=(uint32_t)(&amp;GPIOC-&gt;ODR);\n\n\tDMA2_Stream5-&gt;M0AR=(uint32_t)(seven_segment_lookup);\n\n\n\t\/*Launch DMA*\/\n\tDMA2_Stream5-&gt;CR|=DMA_SxCR_EN;\n\n\t\/*Launch Timer*\/\n\tTIM1-&gt;CR1     |= TIM_CR1_CEN;\n\n\n\twhile(1)\n\t{\n\n\t}\n\n}\n<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>Hence, the entire code as following:<\/p>\n\n\n\n<p><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">#include &quot;stm32f4xx.h&quot;\n\n\n#define data_size \t10\n#define CH6 \t\t0x06\n\n#define COMMOM_ANODE 1\n\n\n\n\n#if COMMOM_ANODE\n\n\nconst uint32_t seven_segment_lookup[] = {\n\n\t    0b11000000, \/\/ 0\n\t    0b11111001, \/\/ 1\n\t    0b10100100, \/\/ 2\n\t    0b10110000, \/\/ 3\n\t    0b10011001, \/\/ 4\n\t    0b10010010, \/\/ 5\n\t    0b10000010, \/\/ 6\n\t    0b11111000, \/\/ 7\n\t    0b10000000, \/\/ 8\n\t    0b10010000  \/\/ 9\n};\n\n#else\n\nconst uint32_t seven_segment_lookup[] = {\n\t    0b00111111, \/\/ 0\n\t    0b00000110, \/\/ 1\n\t    0b01011011, \/\/ 2\n\t    0b01001111, \/\/ 3\n\t    0b01100110, \/\/ 4\n\t    0b01101101, \/\/ 5\n\t    0b01111101, \/\/ 6\n\t    0b00000111, \/\/ 7\n\t    0b01111111, \/\/ 8\n\t    0b01101111  \/\/ 9\n\n};\n\n#endif\n\n\n\n\n\n\nint main(void)\n{\n\t\/*GPIO Configuration*\/\n\n\t\/*Enable clock access to GPIOA*\/\n\tRCC-&gt;AHB1ENR|=RCC_AHB1ENR_GPIOCEN;\n\n\t\/*Set PC0 to PC7 as output*\/\n\tGPIOC-&gt;MODER|=GPIO_MODER_MODE0_0|GPIO_MODER_MODE1_0|GPIO_MODER_MODE2_0\n\t\t\t|GPIO_MODER_MODE3_0|GPIO_MODER_MODE4_0|GPIO_MODER_MODE5_0|\n\t\t\tGPIO_MODER_MODE6_0|GPIO_MODER_MODE7_0;\n\n\tGPIOC-&gt;MODER&amp;=~(GPIO_MODER_MODE0_1|GPIO_MODER_MODE1_1|GPIO_MODER_MODE2_1\n\t\t\t|GPIO_MODER_MODE3_1|GPIO_MODER_MODE4_1|GPIO_MODER_MODE5_1\n\t\t\t|GPIO_MODER_MODE6_1|GPIO_MODER_MODE7_1);\n\n\n\n\t\/*Timer configuration*\/\n\n\tRCC-&gt;APB2ENR  |=  RCC_APB2ENR_TIM1EN;\n\n\tTIM1-&gt;DIER=TIM_DIER_UDE;\n\n\tTIM1-&gt;PSC=16000-1; \/*16 000 000 \/ 16 000 =1 000*\/\n\tTIM1-&gt;ARR=1000-1; \/*1 000 \/ 1 000 = 1HZ*\/\n\n\n\n\t\/*DMA configuration*\/\n\n\n\tRCC-&gt;AHB1ENR|=RCC_AHB1ENR_DMA2EN;\n\n\tDMA2_Stream5-&gt;CR&amp;=DMA_SxCR_EN;\n\n\twhile((DMA2_Stream5-&gt;CR)&amp;DMA_SxCR_EN){;}\n\n\tDMA2_Stream5-&gt;CR|=(CH6&lt;&lt;DMA_SxCR_CHSEL_Pos)|DMA_SxCR_MSIZE|DMA_SxCR_PSIZE|\n\t\t\tDMA_SxCR_MINC|DMA_SxCR_CIRC|DMA_SxCR_DIR_0;\n\n\tDMA2_Stream5-&gt;NDTR=(uint32_t)data_size;\n\n\tDMA2_Stream5-&gt;PAR=(uint32_t)(&amp;GPIOC-&gt;ODR);\n\n\tDMA2_Stream5-&gt;M0AR=(uint32_t)(seven_segment_lookup);\n\n\n\t\/*Launch DMA*\/\n\tDMA2_Stream5-&gt;CR|=DMA_SxCR_EN;\n\n\t\/*Launch Timer*\/\n\tTIM1-&gt;CR1     |= TIM_CR1_CEN;\n\n\n\twhile(1)\n\t{\n\n\t}\n\n}\n<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4. Results:<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<p>Once you compiled and run the code on STM32, this should be the results.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"1-Digit 7-Segment With STM32F4\" width=\"1170\" height=\"658\" src=\"https:\/\/www.youtube.com\/embed\/jhWpUKxax2o?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Happy coding \ud83d\ude42<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guide, we shall see what is 7 segment display and the difference between Common anode and cathode. In this guide, we shall cover the following: What is 7 segment display. Connection of common anode with STM32F4xx. Driver. Results. 1. What is 7 Segment Display: A&nbsp;7-segment display&nbsp;is an electronic display device used to show [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,11,12],"tags":[],"class_list":["post-2389","post","type-post","status-publish","format-standard","hentry","category-embedded-systems","category-peripheral-drivers","category-stm32"],"_links":{"self":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/2389"}],"collection":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2389"}],"version-history":[{"count":2,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/2389\/revisions"}],"predecessor-version":[{"id":2394,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/2389\/revisions\/2394"}],"wp:attachment":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2389"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2389"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2389"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}