<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>2 digit - 7 Segment Display Example</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/16789/2-digit---7-segment-display-example</link><description>Is there an example for using a 10 pin 2 digit 7 segment display similar the picture below? 
 It is common anode and actually has 10 pins (pin 2 is the DP or decimal point).
I have all of the LED pins (1-4 and 5-9) hooked up to their own GPIO and the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 04 Oct 2016 19:49:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/16789/2-digit---7-segment-display-example" /><item><title>RE: 2 digit - 7 Segment Display Example</title><link>https://devzone.nordicsemi.com/thread/64227?ContentTypeID=1</link><pubDate>Tue, 04 Oct 2016 19:49:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c891ceb1-5f6c-428e-aa66-ccfd86f28a2f</guid><dc:creator>Bryan H</dc:creator><description>&lt;p&gt;This worked great!
Thank you for helping out - it is appreciated!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 2 digit - 7 Segment Display Example</title><link>https://devzone.nordicsemi.com/thread/64226?ContentTypeID=1</link><pubDate>Sat, 01 Oct 2016 01:36:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:58ad9a95-5a0b-4411-b6bc-267a7f53c49e</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;something like this typed in without checking&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint32_t leds_bits[2];    // two uint32s with bits set for each segment including the anode bit
uint8_t leds_index;

void called_by_app_timer_regularly()
{
    NRF_GPIO-&amp;gt;OUTCLR = 0x000007fe;    // clear all the pins 1-10
    NRF_GPIO-&amp;gt;OUTSET = leds_bits[ leds_index ]; // set all the pins to the required value
    leds_index = ( 1 - leds_index ); // do the other one the next time
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;leds_bits has bit 5 clear and bit 10 set for one entry and the other way around for the other, plus the bits for the segments you want lit up set. Update that at any point, the next cycle will refresh it. Set up a repeating app_timer (lots of examples for that) to call that function regularly.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 2 digit - 7 Segment Display Example</title><link>https://devzone.nordicsemi.com/thread/64225?ContentTypeID=1</link><pubDate>Sat, 01 Oct 2016 01:12:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d4a7381-a27b-4aba-a1a9-9aee7ac8f86b</guid><dc:creator>Bryan H</dc:creator><description>&lt;p&gt;Yes - you are correct, I typed the numbers wrong - should have been 1-4 and 6-9 as you said. 5 and 10 are common anodes.&lt;/p&gt;
&lt;p&gt;You have been a big help so far!&lt;/p&gt;
&lt;p&gt;Can you explain more (or example code) the repeating app timer (new to nRF).
I set the individual led segments up as LEDs and the Comman Anodes as GPIOs.
I am able to get &amp;quot;Ao&amp;quot; to show on the display with the following code for about 5 seconds with a for loop when a button is pressed but ends up just saying &amp;quot;o&amp;quot; at the end of the for loop:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;            {
        LEDS_OFF(LEDS_MASK);
        LEDS_ON(SEG_A | SEG_B | SEG_C | SEG_E | SEG_F | SEG_G);
        nrf_gpio_pin_write(COMAN1,1);
        nrf_gpio_pin_write(COMAN2,0);
        nrf_delay_ms(5);
        LEDS_OFF(LEDS_MASK);
        LEDS_ON(SEG_C | SEG_D | SEG_E | SEG_G);
        nrf_gpio_pin_write(COMAN1,0);
        nrf_gpio_pin_write(COMAN2,1);
        nrf_delay_ms(5);
        }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Obviously, that will not work in a complete program - mainly with the delay (I need to avoid using that as the program hangs while in delay) and the fact that I assume that I should not be running that in a for loop.&lt;/p&gt;
&lt;p&gt;Can you suggest a proper way to code this?
I want the display to say one thing constantly until a button is pressed to change a setting and then the display will say something else.
I assume this will be done in memory and asynchronously as you stated but I have no idea where to begin with nRF.
Thanks in advance!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 2 digit - 7 Segment Display Example</title><link>https://devzone.nordicsemi.com/thread/64224?ContentTypeID=1</link><pubDate>Sat, 01 Oct 2016 00:38:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e0484e3e-94a3-4db4-8778-1fef650c07cc</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Have no idea if there&amp;#39;s sample code for that, but it&amp;#39;s very simple to write. You just want to round-robin between the two segments giving each a fraction of a second, then going back to the other one.&lt;/p&gt;
&lt;p&gt;Keep the current bitmap of on/off for each segment for each of the two (or more) segments, you can update that whenever you like. Then set up a repeating app timer, or any other repeating timer, which alternately puts one or other bitmap onto the cathode pins  and sets/resets the correct one of the anode pins. Adjust the interval to be fast enough not to flicker, slow enough to give the LEDs time to light up.&lt;/p&gt;
&lt;p&gt;You change the value displayed by simply writing one or other of the bitmaps in memory, it will show on the next cycle for that digit, completely asynchronous and about 5 lines of code.&lt;/p&gt;
&lt;p&gt;I think you have your GPIO numbers wrong, you&amp;#39;ve used 5 twice, so you probably mean 1-4 and 6-9, and hopefully you don&amp;#39;t have the cathodes connected directly to the GPIO pins because any LED display I&amp;#39;ve come across will need way more current than the nRF can sink.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>