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
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • 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
Legacy Personal Blogs The retro clock
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: kk99
  • Date Created: 29 Mar 2020 10:47 AM Date Created
  • Views 2119 views
  • Likes 10 likes
  • Comments 4 comments
  • hdsp-2203
  • rtc
  • stm32
  • bluepill
Related
Recommended

The retro clock

kk99
kk99
29 Mar 2020

image

 

I have recently bought a nice vintage display called the HDSP-2203. The HDSP-2203 is able to display eight ASCII characters. This display has similar interface and commands as the HDSP-2112HDSP-2112. I have decided to connect it to to the "Blue Pill" board which has an STM32 MCU. Connection was made with usage a universal PCB to which was the display soldered. List of mappings of display pins to board pins is present in source code. Display has parallel interface and driving it is really simple. We have control commands which allow to change brightness and to display given character.

image

The code was written in Arduino IDE. In setup part we need to initialize the display and serial.

Additionally the RTC library is used. In main loop firstly we checking if we received a new timestamp via serial . If it is available then RTC is configured based on it. After that there is checking if we should update display with new value of hour, minute and second. Below there is source code:

#include <RTClock.h>

RTClock rt (RTCSEL_HSE);

static const uint8_t RST = PA15;
static const uint8_t FL = PB3;
static const uint8_t A_0 = PB4;
static const uint8_t A_1 = PB5;
static const uint8_t A_2 = PB6;
static const uint8_t A_3 = PB7;
static const uint8_t A_4 = PA0;
static const uint8_t WR = PC15;
static const uint8_t D_0 = PB8;
static const uint8_t D_1 = PC14;
static const uint8_t D_2 = PA1;
static const uint8_t D_3 = PA2;
static const uint8_t D_4 = PA3;
static const uint8_t D_5 = PA4;
static const uint8_t D_6 = PA5;
static const uint8_t D_7 = PA7;

void initDisplay(void)
{
  pinMode(RST, OUTPUT);
  pinMode(FL, OUTPUT);
  pinMode(A_0, OUTPUT);
  pinMode(A_1, OUTPUT);
  pinMode(A_2, OUTPUT);
  pinMode(A_3, OUTPUT);
  pinMode(A_4, OUTPUT);
  pinMode(WR, OUTPUT);
  pinMode(D_0, OUTPUT);
  pinMode(D_1, OUTPUT);
  pinMode(D_2, OUTPUT);
  pinMode(D_3, OUTPUT);
  pinMode(D_4, OUTPUT);
  pinMode(D_5, OUTPUT);
  pinMode(D_6, OUTPUT);
  pinMode(D_7, OUTPUT);

  digitalWrite(WR, HIGH);
  digitalWrite(RST, LOW);
  delay(10);
  digitalWrite(RST, HIGH);
  digitalWrite(FL, HIGH);
  delay(50);
}

void writeCharacter(char character, uint8_t displayNumber)
{
  digitalWrite(A_4, HIGH);
  digitalWrite(A_3, HIGH);
  digitalWrite(A_2, (displayNumber & 0x04));
  digitalWrite(A_1, (displayNumber & 0x02));
  digitalWrite(A_0, (displayNumber & 0x01));

  digitalWrite(D_7, LOW);
  digitalWrite(D_6, (character & 0x40));
  digitalWrite(D_5, (character & 0x20));
  digitalWrite(D_4, (character & 0x10));
  digitalWrite(D_3, (character & 0x08));
  digitalWrite(D_2, (character & 0x04));
  digitalWrite(D_1, (character & 0x02));
  digitalWrite(D_0, (character & 0x01));

  digitalWrite(WR, LOW);
  delayMicroseconds(140);
  digitalWrite(WR, HIGH);
}

void setBrightness(uint8_t level)
{
  digitalWrite(A_4, HIGH);
  digitalWrite(A_3, LOW);
  digitalWrite(A_2, LOW);
  digitalWrite(A_1, LOW);

  digitalWrite(D_7, LOW);
  digitalWrite(D_6, LOW);
  digitalWrite(D_5, LOW);
  digitalWrite(D_4, LOW);
  digitalWrite(D_3, LOW);
  digitalWrite(D_2, (level & 0x04));
  digitalWrite(D_1, (level & 0x02));
  digitalWrite(D_0, (level & 0x01));

  digitalWrite(WR, LOW);
  delayMicroseconds(140);
  digitalWrite(WR, HIGH);
}

void clearDisplay(void)
{
  for (uint8_t displayNumber = 0; displayNumber < 7; displayNumber++) {
    writeCharacter(' ', displayNumber);
  }
}

void setup() {
  // put your setup code here, to run once:
  initDisplay();
  clearDisplay();
  setBrightness(6);
  Serial.begin(115200);
}

static uint8_t timeToSet[11] = { 0 };
static bool isColonSet = false;
static uint8_t hourValue = 99;
static uint8_t minuteValue = 99;
static uint8_t secondValue = 99;

void loop() {
  // put your main code here, to run repeatedly:
  if (Serial.available() > 10) {
    for (uint8_t i = 0; i < 11; i++) {
      timeToSet[i] = Serial.read();
    }
    Serial.flush();
    time_t tt = atol((char*) timeToSet);
    rt.setTime(rt.TimeZone(tt, 1));
  }

  if (!isColonSet) {
      writeCharacter(':', 2);
      writeCharacter(':', 5);
      isColonSet = true;
  }

  if (hourValue != rt.hour()) {
    hourValue = rt.hour();
    writeCharacter((char)((hourValue / 10) + '0'), 0);
    writeCharacter((char)((hourValue % 10) + '0'), 1);
  }

    if (minuteValue != rt.minute()) {
    minuteValue = rt.minute();
    writeCharacter((char)((minuteValue / 10) + '0'), 3);
    writeCharacter((char)((minuteValue % 10) + '0'), 4);
  }

  if (secondValue != rt.second()) {
    secondValue = rt.second();
    writeCharacter((char)((secondValue / 10) + '0'), 6);
    writeCharacter((char)((secondValue % 10) + '0'), 7);
  }

  delay(100);
}

 

 

There is short video presentation:

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

  • Sign in to reply

Top Comments

  • dubbie
    dubbie over 5 years ago +2
    An interesting display. Was this a new version of an old type of display or a genuine vintage piece of electronics (and if it is - where did you get it)? I remember this type of LED display, I always wanted…
  • kk99
    kk99 over 5 years ago in reply to dubbie +2
    It is NOS which I bought for around ~5$ but similar one the HDSP-2112 it is available on market. It is NOS which I bought for around ~5$ but similar one the HDSP-2112 it is available on market. My main…
  • genebren
    genebren over 5 years ago +1
    Nice little clock project.
  • kk99
    kk99 over 5 years ago in reply to dubbie

    It is NOS which I bought for around ~5$ but similar one the HDSP-2112 it is available on market. It is NOS which I bought for around ~5$ but similar one the HDSP-2112 it is available on market. My main plan was to create clock but this display gives you a lot degrees of freedom, so you could easily display any text also. You could control power consumption by changing the brightness, below there is note from manufacturer:

    image

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • dubbie
    dubbie over 5 years ago

    An interesting display. Was this a new version of an old type of display or a genuine vintage piece of electronics (and if it is - where did you get it)? I remember this type of LED display, I always wanted some. Have you thought of displaying additional messages in text, as well as the time? What is the power consumption like?

     

    Dubbie

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • kk99
    kk99 over 5 years ago in reply to genebren

    Thank you.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • genebren
    genebren over 5 years ago

    Nice little clock project.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
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