Coder Social home page Coder Social logo

shenghaoyang / stc_led_clock_8k Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 1.0 418 KB

Firmware for LED clock kits based on the STC 8051 microcontroller family, using parts with 8K of flash.

Assembly 71.08% Makefile 3.16% C 23.90% C++ 1.86%
8051 stc diyclock

stc_led_clock_8k's Introduction

stc_led_clock_8k

Firmware for chinese DIY clock kits based on STC microcontrollers, for parts using devices with 8K of flash.

Hardware requirements

A DIY clock kit using the STC15W408AS microcontroller.

Other parts having 8K of flash (exactly, support for higher capacities TODO), at least 5K of EEPROM, along with a PCA module and conventional timers T0 & T2 should work fine.

Getting Started

Clone or download the repository contents.

To build and flash, you will need:

  1. A working copy of sdcc installed on your machine (to build the firmware)
  2. stcgal (to deliver the firmware payload onto the target device)

Execute the following commands once a USB serial adapter is connected to the ISP port of the device

cd Release
make 
stcgal -o eeprom_erase_enabled=True -t 22118.4 stc_led_clock_8k.ihx

Since significant use of the EEPROM is present, stcgal may report a protocol error on flashing the output hex file, on devices that have already written data to the EEPROM, as the EEPROM data would not be correctly programmed due to a erase cycle for the EEPROM not being performed. In this case, flashing a blank hex file, with -o eeprom_erase_enabled=True and then executing the stcgal flash command listed above is likely to resolve the problem, by enabling EEPROM erase before programming.

Features

  • Time & date display (Both 24h and 12h time formats, MM/DD or DD/MM date formats, configurable leading zero suppression)
  • Temperature display (Centigrade temperature scale only, offset adjustable, 0.1deg C resolution)
  • Versatile alarm system
    • Maximum of seven alarms
    • Global alarm enable / disable
    • Individual alarm enable / disable
    • Alarms triggering on specific days of the week
    • Alarm length limiting
  • Night light function
  • Configurable automatic display scrolling (time, date, temperature, day-of-week, year)
  • Configurable automatic dimming
  • CRC checksumming of BBSRAM contents to detect corruption / power loss

Operation

  • Menu button : Topmost switch

  • Select button : Bottom switch

  • To toggle the night light function (max display brightness) in the time display screen, press the select button. By default (on startup), the display is set to the maximum brightness.

  • Long press on the menu and select buttons to enter the configuration menu

  • Press menu to cycle between the configuration options, press select to enter a configuration section

  • Use the menu and select buttons to navigate a configuration section, press or hold down the select button to change numerical / boolean values

  • Long press menu to save configuration

  • To reset the device, press and hold both select and menu buttons on power application.

Caveats & Bugs

  • Alarm triggering is only checked for once every minute, when not in the settings menu.
  • Display may exhibit slight flickering at the lowest on-time, depending on which specific seven segment display is used by the kit manufacturer.

Porting to other devices

Check out board_config.h . Simply adjust the board specific definitions and initlization functions located in that file.

Note that a common anode display is assumed. Work to support common cathode devices is in progress.

Acknowledgements

  • zerog2k (Initial progress on custom firmware for these diy clocks)
  • aFewBits (Alternate approach to clock firmware, configuration menus, etc)
  • SparkFun Electronics (LED font table was derived from the SevSeg project)

stc_led_clock_8k's People

Contributors

shenghaoyang avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

thinhx2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.