Darrel's interrupts in a 7 segment display


Results 1 to 17 of 17

Threaded View

  1. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    You guys always make me hungry. I LOVE spaghetti.
    Just not in my code.

    Code:
    Main:
      FOR Value = 0 TO 999
        GOSUB SetDisp
        PAUSE 500
      NEXT Value
    GOTO Main
    
    '---[Set 7-seg patterns to WORD value]--------------------------------------
    SetDisp:
      FOR Idx = 2 to 0 STEP -1
        Temp = Value DIG Idx
        LookUp Temp,[132,175,193,137,170,152,144,143,128,136,210,251],Temp
        SEGDEF(Idx) = Temp
      NEXT Idx
    RETURN
    
    '---[TMR1 - interrupt handler]----------------------------------------------
    DISP:
      T1CON.0 = 0                  ; stop timer
      TMR1H = %11111100
      TMR1L = %00011111
      T1CON.0 = 1                  ; restart timer
    
      PORTE = %111                 ; turn off all digits to prevent ghosting
      PORTC = SEGDEF(digitloop)    ; put segment pattern to pin
      PORTE = ~(DCD digitloop)     ; turn on the digit
    
      digitloop = digitloop + 1    ; prepare for next digit
      IF digitloop = 3 then digitloop = 0
    @ INT_RETURN
    Completely untested ...
    Attached Files Attached Files
    DT

Similar Threads

  1. 7 Segment Displays and MAX7219
    By Bill Legge in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 31st October 2010, 18:30
  2. LED Machine Tach For Tired Eyes
    By Archangel in forum mel PIC BASIC Pro
    Replies: 33
    Last Post: - 27th January 2010, 14:55
  3. Weird compile issue 7 segment LED display
    By George in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 21st June 2006, 02:12
  4. 7 segment digit problem (using Mister E's code)
    By jmgelba in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 9th September 2005, 20:25
  5. WRITE not working
    By servo260 in forum mel PIC BASIC Pro
    Replies: 31
    Last Post: - 29th December 2004, 02:02

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