element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Nico teWinkel's Blog Clock display is running
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: ntewinkel
  • Date Created: 24 Aug 2011 4:58 PM Date Created
  • Views 465 views
  • Likes 0 likes
  • Comments 0 comments
  • clock
  • xl_star
  • segment
  • display
  • 7
  • summer_of_design
Related
Recommended

Clock display is running

ntewinkel
ntewinkel
24 Aug 2011

I gave up on the button issue for the time being, and started from scratch with a new project file to work on my clock display.

 

image

 

I created a new project pretty much using the exact steps as outlined in the document XL_STAR_Introduction.pdf in "part 8. Writing Your Own Code".

 

I used the diagram from part 7 of that document to learn how the orange star LEDs are connected.

I then pulled up the diagram for my LTC-617D1G clock display and with a few test leads determined how the pins were numbered, and which side was anode and which was cathode.

 

Using the two diagrams together, I assigned XL_Star pins to the display pins, and connected them using standard F-F patch wires (I had previously soldered headers onto the XL_Star and the clock display). The picture shows generally how they were connected, but the attached LTC-617 diagram has my pin connections listed.

Note that pin 1 on the clock display is at the bottom left, and every hole counts, even the ones that don't have any connections. In my case, "pins" 11 to 21 are just holes. And I left am/pm and alarm disconnected for now.

 

image

 

Then I started with the very basic code to turn on a single LED, which is attached as main_basic_led.c  (renamed from main.c in my project)

 

Once I had that figured out, I went on to write the function to display a specific digit in one of the four positions.

For this basic clock display, each digit is just a 7 segment display, so I could have used a separate BCD to 7-seg chip, but that's more hardware I prefer to avoid. So I did the same thing in code.

You might have noticed from the LTC diagram that the 7 segments are all connected to the same 7 pins - this means only one digit can be shown at at time. So we need to put power to one of the top pins to select which of the clock digit positions is active.

I also added a function to show the colon in the middle.

 

Then I added a function to display a time, which shows all 4 digits and the colon in sequence, keeping each item lit for a brief amount of time using a small delay loop. Calling this function repeatedly in the main forever-for loop makes it look like all digits on the clock are displayed. In reality it flashes really fast, and if you increase the delays you'll see the flashing as it shows each individual clock digit.

 

I also noticed that digits with fewer LEDs lit were brighter than others, so I made the delay depend on how many LEDs are lit. For example, the colon, and the 1 have 2 LEDs lit, so it stays on for 200 loop counts. An 8 has 7 LEDs lit, so it stays on for 700 loop counts. This very basic approach actually seems to work well to make all the digits appear to have the same brightness.

I used a macro named DELAY to do the delay loop. Note that if you add any variable access or math, the loop will take longer as it takes clock cycles to do math and variable fetching and such. That's why I always set a variable that I pass into the macro, to keep the delay loop predictable.

 

And that's as far as I got this morning. The clock display doesn't actually display a time yet, so I set it to 12:00 to simulate the average VCR image

My wife says I need to make it flash on the 12:00 though, so I guess I need to figure out the timers next!

 

ps, the LTC-617 display is something I got in a grab-bag of displays a while back, so I assume they are cheap and plentiful (I have about 4 of them), and otherwise you can probably rip one out of an old clock radio.

 

Attached:

clock_running.jpg - a picture of the clock display running connected to the XL_Star board.

LTC-617 connections.png - the pin connections for the LTC display connected to the XL_Star board.

main_basic_led.c - the source code for lighting a single LED in the star, and it lights the colon if you have the clock display connected.

main_clock.c - the source code for lighting up digits on the clock display. Without the clock it lights up patterns in the star.

 

  PTCD |= (1 << 3);
  PTED &= ~(1 << 7);  PTCD |= (1 << 3);
  PTED &= ~(1 << 7);

 


 

Attachments:
main_clock.c.zip
main_basic_led.c.zip
  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube