how to setup 7 digit led multiplexer code for running in background?


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2013
    Posts
    1,078

    Default how to setup 7 digit led multiplexer code for running in background?

    Hello.

    I want to drive 4 digit 7 segment led display directly with 16F870, without using MAX7219, HC595 or any other IC. I know how to wrote the needed code and when launched in loop, it works just fine. However, this code needs to be run constantly, to maintain the display reading. So, how to run other tasks together with this code? as I understand, I need to set up an timed loop interrupt, so my main code is interrupted 25 times per second (to avoid the flicker) and lcd indication code is launched?

    I need a hint, how to set-up hardware in such way, that say MAINLOOP code is interrupted 25 times a second and DISPLAYLED code launched, completed and then execution returned to MAINLOOP.

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: how to setup 7 digit led multiplexer code for running in background?

    I would look at DT's Instants
    http://www.picbasic.co.uk/forum/showthread.php?t=3251

    The elapsed timer might be what you need, with a little modification...
    http://darreltaylor.com/DT_INTS-18/elapsed.html
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Feb 2013
    Posts
    1,078


    Did you find this post helpful? Yes | No

    Default Re: how to setup 7 digit led multiplexer code for running in background?

    Thanks, looks interesting!

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,588


    Did you find this post helpful? Yes | No

    Default Re: how to setup 7 digit led multiplexer code for running in background?

    I'm doing it backwards. Mainloop turns on leds, start a timer, while timer runs gosub main code, turn off leds when timer over. Start a 2nd timer for off period, gosub main code until over. Rinse and repeat.

    I adjust 2 timers until no more flicker.

    Robert

  5. #5
    Join Date
    Feb 2013
    Posts
    1,078


    Did you find this post helpful? Yes | No

    Default Re: how to setup 7 digit led multiplexer code for running in background?

    The problem is, when looking at that sample code, I see only the part of code, which runs on interrupt. I have no idea where to insert the "main" code?

  6. #6
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,588


    Did you find this post helpful? Yes | No

    Default Re: how to setup 7 digit led multiplexer code for running in background?

    In here:

    Code:
    Main:
      IF SecondsChanged = 1 THEN  
         SecondsChanged = 0
         LCDOUT $FE,2, DEC Days,"d-",DEC2 Hours,":",DEC2 Minutes,":",DEC2 Seconds
      ENDIF
    GOTO Main
    You check the status of the timer flags to determine if things have changed, then reset them.

    Robert

Similar Threads

  1. Single digit 7 Seg LED clock - PIC16F88
    By thirsty in forum Code Examples
    Replies: 4
    Last Post: - 17th July 2009, 09:42
  2. Replies: 2
    Last Post: - 14th July 2008, 23:11
  3. 20 Digit Virtual LED Counter
    By T.Jackson in forum Code Examples
    Replies: 9
    Last Post: - 19th November 2007, 06:02
  4. Using a MAX7219 (LED digit multiplexer) with a 16F88
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 11th March 2007, 22:11

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts