Bug in my timekeeping code


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Nov 2008
    Posts
    41


    Did you find this post helpful? Yes | No

    Default Re: Bug in my timekeeping code

    Quote Originally Posted by Dave View Post
    I also see the same mistake in the 24 hour mode where you say if hour = 25 then hour = 1. 24 hour time starts from 00:00 to 23:59.

    BTW, Nice PCB. I have some RCA Numitrons with 9 pin sockets. I was thinking about using them for a clock but the lifetime of the tubes isn't very good so I built a couple of nixie clocks with VM1000 tubes. Attacked is a photo.

    Dave Purola,
    Dave, nice looking clock as well. The boards came from a place called OSH Park. They run batches of boards so the average time is about two weeks but the quality and price is great. Purple boards seem to be their trademark. If you are worried about longevity of the numitrons you can use the TLC5916 or similar chips from TI. They are meant for driving LEDs and have an adjustable constant current feature. For some reason the minute digits were both dimmer than the hours and needed slightly different resistor values.

  2. #2
    Join Date
    Nov 2008
    Posts
    41


    Did you find this post helpful? Yes | No

    Default Re: Bug in my timekeeping code

    Forgive my ignorance but I can not see why during the timekeep loop that the minutes increment to 01 if they are set to 00 from the previous loop

    Code:
    timekeep:							
    ss = ss + 1							
    if ss = 60 then
    	ss = 0 
     	mm = mm + 1
    endif
    if mm = 60 then 
    	mm = 0
    	hh = hh + 1
    endif
    if hh = 13 then hh = 1				
    v1 = hh DIG 1
    v2 = hh DIG 0
    
    v3 = mm DIG 1
    v4 = mm DIG 0
    
    if hh < 10 then
    lookup v1, [$00,$60,$57,$76,$6C,$3E,$3F,$70,$7F,$7E], v1
    else
    lookup v1, [$7B,$60,$57,$76,$6C,$3E,$3F,$70,$7F,$7E], v1
    endif
    
    lookup v2, [$7B,$60,$57,$76,$6C,$3E,$3F,$70,$7F,$7E], v2
    lookup v3, [$7B,$60,$57,$76,$6C,$3E,$3F,$70,$7F,$7E], v3
    lookup v4, [$7B,$60,$57,$76,$6C,$3E,$3F,$70,$7F,$7E], v4
    
    shiftout dat, clk, 0, [v2, v1]
    pulsout hstro, 10
    shiftout dat, clk, 0, [v4, v3]
    pulsout mstro, 10
    
    INTCON.2 = 0						'Clear interrupt flag
    resume startloop					'Go back to the do nothing loop
    Looking at this statement

    Code:
    ss = ss + 1							
    if ss = 60 then
    	ss = 0 
     	mm = mm + 1
    endif
    The minutes should be at 00 until 60 seconds have been counted. Why is it jumping to 01 instead?

  3. #3
    Join Date
    Apr 2011
    Location
    Welches, Oregon
    Posts
    198


    Did you find this post helpful? Yes | No

    Default Re: Bug in my timekeeping code

    The only other place I see you modifying the mm value is in the "setmm:" routine. You do not say if you are setting the clock (where the code in your OP sets mm = 1) or not.

Similar Threads

  1. FOR..NEXT Loop Bug?
    By MSapper in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 12th April 2011, 02:04
  2. Bug or something else
    By pedja089 in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 7th February 2011, 15:58
  3. Did I find a bug or bug found me?
    By sayzer in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 13th September 2008, 10:58
  4. PBP bug ???
    By boban in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th March 2008, 17:30

Members who have read this thread : 0

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