Coder Social home page Coder Social logo

music-alarm-clock-c51's Introduction

Music-Alarm-Clock 音乐闹钟

A music alarm clock based on a 51 single -chip machine.

一个C51单片机实现的音乐闹钟。

编译说明

请根据实际使用的51单片机型号修改代码。

本代码可使用Keil进行编译。

效果展示:

image image

实物or仿真使用说明

1. 按键

K1 :模式切换。 在时间、秒表,闹钟 0,闹钟 1,闹钟 2 间循环切换。

K2:设置状态下增加数值或设置开启,秒表状态下为开始计时。

K3:设置状态下减少数值或设置关闭,秒表状态下为暂停计时。

K4:进入设置、设置切换(进入下一个设置选项),秒表清零。

注:任意按键均可让闹铃和整点报时停止。

2. 时间日期农历显示

该页面包含日期、星期、时间、农历信息。

按动 K4 按钮可进入设置状态,使用 K2、K3 对选中数值进行调整,操作完毕后再次按动 K4 进入下一项配置。支持配置过程中进行模式切换,已修改的信息会保留。

3. 秒表显示

精度支持百分之一秒 且经手动计算校准补偿误差极低。(仅针对CH549单片机开发板进行校准)

在此页面下可分别通过 K2、K3、K4 按键实现开始、暂停、清零操作。且支持后台计时,在计时过程中可以切换其他模式显示操作。

4. 闹钟显示

闹钟包含 A0,A1,A2 三个闹钟,按动 K1 可以在不同闹钟间切换,选中的闹钟 A(x)会突出显示,最上方的星期为该闹钟的星期重复,可以按动 K4 以及K2、K3 按键对闹钟时间,星期重复进行配置。

5. 整点报时

预设 8:00-21:00 间按 12h 计数进行报时,12 时响 12 次,13 时响一次。

6. 串口相关设置 (ASKII 字符串进行控制)

说明:操作成功会返回OK,异常则不显示。

设置时间指令:T2022-01-01 00:00:00

读取当前时间:GET

闹钟设置: A+闹钟数+HH:mm:ss+ +日一二三四五六(循环周期开 1 关 0)

Eg. A0 06:00:00 0111110 设置 A0 闹钟为工作日早 6 点响。 秒表操作: 清零:S0 开始:S1 暂停:S2

按钮模拟:模拟按键 K1-K4 eg. B0 B1 B2 B3

单片机资源使用说明:

定时器 0:音乐以及整点报时相关处理

定时器 1:UART0 波特率发生

定时器 2:时间状态处理,秒表状态处理,按键状态处理,闹铃状态处理,整点报时状态处理。

接线说明:

P3.0、P3.1 接外部无线串口通信模块

P2.6、P2.7 接 OLED 的 SCL、SDA

P1.0 接三极管控制蜂鸣器

P1.4-P1.7 接 K1-K4 按键

music-alarm-clock-c51's People

Contributors

djylb avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.