Nixie Blanking Code

Discussion in 'Programmer's Corner' started by PICmetoo, May 15, 2012.

  1. PICmetoo

    Thread Starter New Member

    Apr 6, 2012
    21
    0
    I recently built this Single Digit Nixie Clock.
    http://www.electronixandmore.com/nixieclocks/3.html
    I’m not new to electronics but must confess that I know very little when it comes to programming only dabbling in Picaxe’s and Arduino’s. I was so taken by this little clock I even got round to having a pcb made for it. The only draw back I could find was that there is no option to blank the display when not being viewed and so prolonging the tube. It could be incorporated within the cold and fixed as I don’t really need it to be changeable with menus.
    If anyone could help I would greatly appreciate it.
     
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,607
    To blank it you just don't drive any of the 10 segments.
     
  3. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    Pin RA4 isn't being used so you could put a switch there and a small addition to the code would blank the display.
     
  4. PICmetoo

    Thread Starter New Member

    Apr 6, 2012
    21
    0
    Thank you for your prompt reply. I've also been told that the code could be changed to load the hours register in the main loop and compare against the blanking time period that's desired to determine when to skip the display call routine. I was hoping that with some help a blanking option would then make the clock a very worthwhile project. I have designed and had manufactured a number of professionally made PCBs and using an IN-12 with socket and led back lighting it's also very attractive. The whole idea was to give them as presents to the family. I think it would probably be a good idea to offer one for services rendered as i know very little when it comes to writing code and i was not a where what was involved.
     
  5. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    I might have a go at this tonight or tomorrow, seems it should be an easy change. Just thought I'd check that no one else is working on it before I start, I noticed that you have posted on a couple of other forums.
     
  6. PICmetoo

    Thread Starter New Member

    Apr 6, 2012
    21
    0
    Hi Markd77, yes I have posted this question on other forums. It's not that i'm desperate more eager than anything. At the moment i don't have anyone working on the code. I am also using the chime logic pulse output on pin 2 (RA3) to operate a buzzer, beeping on the hour, 1 beep for 1 o'clock, 2 beeps for 2 o'clock etc, with a pcb switch to turn it on and off. This is all incorporated on the pcb. I'm hoping to replace this with a small mechanical bell and soleniod at a later stage so that it will chime. any help is always greatly appreciated.
     
  7. PICmetoo

    Thread Starter New Member

    Apr 6, 2012
    21
    0
    Hi Markd77, A small switch could easily be incorporated within the case and there is plenty of room to attach the resistor. I have a picture frame that lights up and has a power saving feature which allows the frame to light up for three hours before turning off. This sort of feature would make the clock much more useable.
     
  8. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    Oops, you just replied to the post I deleted, sorry. I realised that as it already has a button, that could serve dual purpose for setting the time if the display is on, or turning the display on for a while if it is blanked. Let me know if you want the extra button for turning the display on, you might think it's better in that you can make the time setting button less easy to access.
     
  9. PICmetoo

    Thread Starter New Member

    Apr 6, 2012
    21
    0
    Hi, I thought it was strange that your post disappeared. A second button would not be a problem as it could be placed in a convenient position and easy to access. This would allow the time setting button to stay on the pcb facing backward. Currently I'm using a simple acrylic case designed using CorelDRAW and manufactured by RazorLab. This additional button would be easy to install.
     
  10. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    OK, I'll use the second button for turning the display on for a while. It's actually a bit easier.
    The changes to the code are nearly done now.
     
  11. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    OK, I think this should work unless I left some bugs in.
    The new button should be connected from pin 3 to 5V, and a 1K resistor from pin 3 to 0V.
    What should happen with the settings as they are is that the display should go on for 3 minutes at startup then turn off. Pressing the button should unblank for about the same time (actually it unblanks for the rest of the current minute plus 3 minutes). You can change that by altering the first line in this section:

    Code ( (Unknown Language)):
    1. CONST_MINS_UNTIL_BLANK EQU d'3'
    2.  
    3. UNBLANK1_MIN EQU d'0'
    4. UNBLANK1_MIN10 EQU d'1'
    5. UNBLANK1_HOUR EQU d'0'
    6. UNBLANK1_HOUR10 EQU d'1'
    7.  
    8. BLANK1_MIN EQU d'5'
    9. BLANK1_MIN10 EQU d'2'
    10. BLANK1_HOUR EQU d'0'
    11. BLANK1_HOUR10 EQU d'1'
    12.  
    13. UNBLANK2_MIN EQU d'1'
    14. UNBLANK2_MIN10 EQU d'3'
    15. UNBLANK2_HOUR EQU d'0'
    16. UNBLANK2_HOUR10 EQU d'1'
    17.  
    18. BLANK2_MIN EQU d'7'
    19. BLANK2_MIN10 EQU d'3'
    20. BLANK2_HOUR EQU d'0'
    21. BLANK2_HOUR10 EQU d'1'
    The time at startup is 1000h
    The first unblank time is 1010h which you change with the next 4 lines in the code. I did something wrong so it actually unblanks a minute late, but I figured it's no big deal.
    It should then blank again at 1025h, unblank again at 1031h and blank at 1037h

    I've added the 2 sections mainly because if you want it to unblank around midnight, you need one section going up to midnight and one section after (if you set the blank time earlier than unblank it won't work properly.) I can add more unblanking periods if you want, it's easy.

    I've put
    ;new code
    ;/new code
    around the bits I've changed.

    Have a go and fingers crossed that it works.
     
  12. PICmetoo

    Thread Starter New Member

    Apr 6, 2012
    21
    0
    Hi Markd77, It seems that you have the original 24hr code. I started to compile it and realised it was the same code.
     
  13. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    Oops, copied the wrong file, sorry about that. Here it is:
     
  14. PICmetoo

    Thread Starter New Member

    Apr 6, 2012
    21
    0
    I connected it up but it seems that the switch isn't working. The time setting switch is ok but when the blanking switch is pressed nothing happens. I'm not sure why it's not working, everything is connected ok. Have you any ideas?
     
  15. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    I'd call it an unblanking switch, it should do nothing if the display is on.
    What happens if you turn the clock on and leave it for 3 minutes, does the display turn off?
    If it does, does anything happen if you press the button?
    Does it turn itself back on 10 minutes from power up?
     
  16. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    I just noticed that I'd put the button checking in a part that only gets executed once a second, I've moved it so it gets checked about a hundred times a second.
     
  17. PICmetoo

    Thread Starter New Member

    Apr 6, 2012
    21
    0
    Success it's up and running. Basically it's running how you coded it. Press the button and the display lights up for 3 min or so, otherwise it stays permanently off. I have a couple of questions now that it's running. Does this new routine have any affect on the time keeping. Also how long could the display be adjusted to stay on.
     
  18. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    Good news it's doing something now.
    It doesn't affect the timekeeping at all.
    Does the daily unblanking period work?
    In the section of code I posted back in post #11:
    The first line controls how many minutes the display turns on for when the button is pressed (and at intiial power on). Maximum value is 255 minutes.

    The next 4 lines set the time that the display is unblanked every day. Make sure you only put digits 0-9 in these lines. If you wanted to unblank at 1234h you would put:
    4
    3
    2
    1
    in between the single quotes on those lines.
    The next 4 lines are to blank the display again.

    The next 8 lines are for another unblanking period. If you don't need an unblanking period I think you can set the blank time to earlier than the unblank time.
     
  19. PICmetoo

    Thread Starter New Member

    Apr 6, 2012
    21
    0
    I've only just realized what you have manage to do, and yes at 1010h it unblanked itself. Is there any conflict if the unblanking button is pressed just before an unblanking period. As it is at the moment if i press the button just before a blanking period say 10.08h will it continue until 1025h without conflict. It's running really well at the moment.
    I mentioned in past posts that I've been using the chime function to drive a 5v buzzer. Unfortunately I've not had much success it reducing the sound output. I notice that the chime output has a duration value in the code. Would it make sense that if this duration was cut to a very short pulse it would help to reduce the output. My aim was to produce the equivalent to a wrist watch beep.
     
  20. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    There shouldn't be any annoying conflicts, but it's worth testing. If the unblanking button is pressed before a daily unblanking time there should be no difference. If it's pressed just before a daily blanking time, it should stay unblanked for the whole 3 minutes (or whatever it's set to) then blank. It's unlikely that it would be pressed while the display is on, but it shouldn't cause any problems apart from extending the unblanking time if it's pressed close to the end.
    I think it should be possible to change the chime duration, it would still chime every second, but for shorter. I'll have a look tomorrow.
     
Loading...