来源:
PIC16 lxyppc
用LED实现的一个怀表
http://www.eng.yale.edu/pep5/pocket_watch.html
简单的翻译一下技术部分
Clock Face and Circuit
I had the idea of using LEDs to represent the position of the hands, although I've since learned that it's been implemented in larger clocks before, but I've yet to find an example this small. There are 133 surface mount LEDs on the front face, all hand-soldered: 60 for seconds, 60 for minutes, 12 for hours and one for charging status. The great challenge was fitting all the 0603 LEDs and mosfets on the front dial; obviously, surface mount components were a must. The PCB is 44mm across.
我想到了用LED来显示表的指针,有人做过大尺寸的,但是没人做过小的。我用了133个表贴的LED,全是手工焊接的。60个做为秒针,60个做分针,12个做时针,还有一个用来表示充电的情况。最麻烦的就是焊这些0603的LED和三极管(mosfet?)。 PCB直径为44mm。
To reduce the pin count, each set of 60 LEDs is divided up into six banks of ten, selected by a mosfet. Long circular tracks run around the outside of the board, connecting one LED from each bank to a drive pin. Each hour pin is controlled invidually. Everything is controlled by a PIC 16F946 - an 8-bit micro with plenty of IO pins. The spiralling via pattern this produces is quite aesthetically pleasing.
为了减少使用的IO,60颗灯分为6组,用mosfet来进行组选。时针的LED是用IO单独控制的.所有的这些都是用PIC 16F946实现的。布线产生的螺旋线非常好看。(布线也是一种艺术
)
The clock face itself includes hour marks and Roman numerals for reading the time, as well as pin number markers on the centre IC. The outer-most LED ring is red for seconds, the middle is blue for minutes and the inner-most is blue for hours - this is in line with the standard relative lengths of clock hands. Underneath the chip is stenciled a tiger eye (a subtle reference to my grandfather's long-time association with the Freemasons). The watch is watching you!
表盘有罗马数字读数和IC的引脚数字。最外层红色LED是秒针,中间蓝色的是分针,最里蓝色的是时针。和传统的钟表一样。
On the reverse side is room for all the power regulation, charging, programing, precision timing and IO hardware. The watch runs off a single-cell 110 mAh Lipo cell, recharged through a jack underneath the back cover. The bottom side also has pads for a Temperature Controlled Crystal Oscillator (TCXO) capable of 1 part per million timing precision, although this hasn't been tested yet. A cell-phone vibrator is attached to the inside back cover; every second the vibrator pulses, using the cover as a sounding board to produce an audible 'tick'. The vibrator also serves as an alarm buzzer.
表的背面放着电源转换模块,充电模块,编程模块,时间调整等硬件模块。这块表由一个100mAh的锂电池供电,通过背后的插孔充电。底部还有一个1ppm的温度补偿晶体振荡器的焊盘,但是还没有测试过。后盖中有一个手机的振动电机,每一秒都会被通上电,用来模拟秒针的滴答声。同时这个振动电机也做为闹钟的蜂鸣器。
User Interface and Programming
The watch is controlled by an encoder and two switches. The encoder (from Alps - the tiniest I have ever seen) sits in the slot milled in the PCB, and connects to the stem via a hexagonal channel sized to fit its square end, milled by hand. When the crown is depressed, the stem slides through the encoder and pushes a rotating disc against a switch. A collet and grub-screw hold the stem in place. The second switch is positioned behind the time-set button, although it has not yet been implemented.
这只表由一个编码器和两个开关控制。编码器(来自Alps-我见过的最小的)放在PCB的槽中,通过六角管道连在表柄上。当表冠按下时,表柄会触发一个开关。另一个开关在时间设置开关旁,虽然还没有实现。
The microprocessor was programmed in C using the MikroC IDE for 8-bit PIC microprocessors. Unfortunately, I only have the demo version of this software, which has a 2KB code-size limit. By far the hardest part of this project was writing my code to fit within this limitation; almost without exception, though, it made my code better, more streamlined and more elegant. I can easily say it's made me a better coder.
芯片代码用C语言编写,在MikroC中开发。我只有2KB限制版本,所以花了很多功夫去写代码满足这个要求。这使我的代码更优秀,更精简,更美观。
Most of the time, the watch will be in standby mode, with the LEDs turned off to save power. When the crown is pressed to open the case the stem switch is also depressed, bringing the watch out of standby and into display mode. The LEDs will progress each second, and when a minute or hour is incremented, a the LEDs will light through 360 degrees to advance to the next position, producing a decorative swirl. After 15 seconds of display, the LEDs will turn off and the watch will go back into standby mode.
大部分时间表工作在待机模式,为减少耗电所有的LED都会关掉。当用按下表冠去打开表盖时,连在表柄上的开关也会按下,这会让表从待机模式退出工作在显示模式下。LED在每秒会更新。当分钟或小时更新时,LED会绕一圈后更新到下一个位置,产生一个旋涡的特效。15秒后会自动进入待机模式。
To set the time, the stem is depressed and held in for 3 seconds to enter programming mode. The second hand will then stop incrementing and be set to the 12 o'clock position. Twisting the crown will cause the minute and hour hands to increment or decrement. Pressing the button for another second will exit programming mode.
时间设置:按下表柄3秒进入设置模式。此时秒针会停在12点处。转动表冠可以增加或减少时针和分针。再按一次会退出设置模式。
The pocketwatch also has an alarm function. The alarm is set by holding depressing the stem for 1.5 seconds, whereupon the LEDs will begin to blink. Setting the alarm is handled identically to setting the time. Entering alarm mode sets the alarm on; it will stay on until programming mode is entered, or until the alarm rings. When the alarm goes off, the vibrator inside will pulse in time with flashing LEDs displaying the time.
这块怀表还有闹钟的功能。按住表柄1.5秒进入闹钟设置模式,这些LED会开始闪烁。与设置时间相同。闹钟会被打开直到再次进入闹钟设置模式或是闹钟响起。当闹钟响的时候,表会振动,LED会闪烁。
The LEDs are very bright at night - so much so that they can be dazzling when you turn the watch on. To avoid this, an optical sensor was placed on the front dial. In display mode, the sensor reads the ambient light level and dims the lights if it's too dark, or brightens them if it's light. This way, the display is comfortably readable even in complete darkness or direct sunlight.
LED在晚上很亮,以致于会看不清时间。为避免这种情况,前面板装了一个光学传感器。在显示时,传感器先得到前环境光亮度,如果环境光太暗就减弱LED的亮度,如果环境光很强就增加LED亮度。这样无论在黑夜或是阳光下都能清楚的看见时间。
[
本帖最后由 fish001 于 2009-11-11 14:01 编辑 ]