Connect with us

analog clock on ntsc display

Discussion in 'General Electronics Discussion' started by rebeltaz, Dec 19, 2014.

  1. rebeltaz

    rebeltaz

    32
    0
    Nov 22, 2012
    Hi guys! I have been really into buildings clocks lately, and my moc (microprocessor of choice) of late is the msp430 - http://www.robotsandcomputers.com/robots/projects/nixieclock.htm - as well as a couple more that I haven't posted to my site yet.
    My latest idea, though, is a little outside my area of expertise. I have available to me two really cool, small, clear cased, crt monitors with ntsc composite inputs. I would really like to build a circuit with which I could display an analog clock display on one of these. I have read several pages detailing how to generate ntcs signals with micropressors such as the pic IC, and while I think I might could figure out the general aspects of displaying signals on the crts, I am pretty sure that my math is not good enough to figure out how to draw an analog clock display.
    I am wondering if anyone has ever, or has any ideas on how to, display an analog clock on a crt? While I prefer the msp430, I am open to almost any base processor - msp, pic, arduino...
    I am going to look into just displaying an analog clock via a screensaver with a raspberry pi (what with it's built-in composite output), but I would really rather use a chip-based circuit if I could. Any ideas would be greatly appreciated!
     
  2. Harald Kapp

    Harald Kapp Moderator Moderator

    9,395
    1,918
    Nov 17, 2011
    Split your task into two:
    1. Set up a memory area within the processor's memory that serves as a "canvas". "Draw" the clock's elements (border, markings for minutes and hours, hands) to this canvas. Routines for drawing lines and circles etc. can be found on the internet.
    2. Set up a display routine that reads from the canvas (aka the respective memory area) and creates the equivalent NTSC signal for the monitor.

    Both routines are independent and can be triggered by a suitable interrupt.

    If you are bothered by image distortions during the time the clock's "image" is updated by the first routine (e.g. every second), You can use so called "double buffering": Set up two memory areas as above. Read from only one memory area at a time. You can then write to the other memory area without disturbing the image. Switch between memory areas whe you are done with updating the clock's image in one memory area. Alternate this between updates to the image.

    Depending on how many bits you reserve per pixel, you can also create color-images - assuming your monitors support color.
     
  3. BobK

    BobK

    7,645
    1,662
    Jan 5, 2010
    Most microcontrollers would not have enough RAM to do what Harald is suggesting, i.e. have a frame buffer. Even a very low resolution 320x200 monochrome display would require 8K bytes of RAM, which is high, for a microcontroller, though not out of the question. To go to 640x400 and even 3 bit color would be out of the range of RAM available on PIC microcontrollers.

    An interesting variant would be to try to do this without a frame buffer. To do that, you would compute, for each scan line, which, if any, pixels would be on the lines of the "hands", then simply turn on those pixels only in each scan line. That way you would need only a two single line buffers and be computing the next one while one is being displayed.

    Bob
     
  4. rebeltaz

    rebeltaz

    32
    0
    Nov 22, 2012
    yeah, the MSP has a maximum of 256 bytes RAM and 8-16 KB Flash (as far as I know) so.... any idea where I could find examples of how to calculate the clock face and hand positions? That's the math that I am going to have trouble with... lol
     
  5. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,266
    Nov 28, 2011
    Five years ago I was using the MSP430F1611 which has 10 kilobytes of RAM.
     
  6. Harald Kapp

    Harald Kapp Moderator Moderator

    9,395
    1,918
    Nov 17, 2011
    Draw a circle: http://en.wikipedia.org/wiki/Midpoint_circle_algorithm
    Draw a line: http://en.wikipedia.org/wiki/Line_drawing_algorithm

    Position/angle of the line for the hands:
    A circle has 360 degrees.
    An hour has 60 minutes, therefore angle_m =360°/60 * minutes (depending on how you count the angle, you may have to offset this by 90 degrees for 0 degrees at 0 minutes)-
    The clock shows 12 hours, therefore angle_h = 360°/12 * hours(depending on how you count the angle, you may have to offset this by 90 degrees for 0 degrees at 0 hours)-
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-