矿石收音机论坛

 找回密码
 加入会员

QQ登录

只需一步,快速开始

搜索
楼主: Julie

[实验] PIC 控制的旋转LED电子钟

[复制链接]
     
发表于 2008-3-25 18:52:54 | 显示全部楼层
机械上做的过于复杂了,简单的组成一排LED,和单片机构成一个小玩意,随便放在哪个旋转的东西上(如自行车轮,电风扇前面慢转的那个叶子上)就可以显示了,至于显示什么,软件控制即可。
     
 楼主| 发表于 2008-5-5 19:40:06 | 显示全部楼层
出国打工,中断了几个月,现在继续.......

硬件测试OK!

J0001.jpg

J0002.jpg

J0003.jpg

J0004.jpg
     
发表于 2008-5-6 11:57:04 | 显示全部楼层
平衡还没做呢
     
 楼主| 发表于 2008-5-7 07:33:43 | 显示全部楼层
回复nnn2688:
平衡已做,参见附图的5分镍币。不过还是有一点点偏心,高速旋转后有一点振动,因此加了个较重的铁座。
     
发表于 2008-5-7 09:21:49 | 显示全部楼层
有兴趣!想做个 不过想想还是算了吧!
发表于 2008-5-8 13:16:12 | 显示全部楼层
"出国打工,中断了几个月,现在继续......."
牛!
旋转的噪音大吗?
     
 楼主| 发表于 2008-5-9 20:18:11 | 显示全部楼层

回复 stc89c54

平衡已做好, 高速旋转的噪音很小, 就风声而已, 和CD机的旋转噪音相当.
     
 楼主| 发表于 2008-5-9 20:31:37 | 显示全部楼层
开始写软件了, 现学现用, 立竿见影. 请高手指教.
[第一步] 能稳定显示字符 0 1 2 3 4 5 6 7 8 9 :

p02.jpg

p01.jpg
     
 楼主| 发表于 2008-5-10 07:00:30 | 显示全部楼层
程序(试验1)
;-------------------------------------
; File: JLED100.asm
;        For Julie Rotational LED Clock
;        H/W:  PIC16F84, 4MHz Crystal
;        Ver:  0.00
;       Date: 08/05/2008     By: Julie Jean
;-------------------------------------
       list          p=16f84
       include    "p16f84.inc"

;-------------  Variable ------------
       cblock     0Ch
                temp        ; b0=sync
                i               ; for delay
                coln          ; display column
                digit          ; display digit
                tot            ; total offset
        endc

;-------- Start ---------
        org        0h
        goto      Main
        
        org        4h
        retfie

;-------- Table ----------
Table  addwf  PCL,1
          dt        0C1h,0BEh,0BEh,0BEh,0C1h        ; "O"
          dt        0FFh,0FEh, 80h,0DEh,0FFh          ; "1"
          dt        0CEh,0B6h,0BAh,0BCh,0DEh       ; "2"
          dt        0B9h, 96h,0AEh,0BDh,0BEh         ; "3"
          dt        0FBh, 80h,0DBh,0EBh,0F3h         ; "4"
          dt        0B1h,0AEh,0AEh,0AEh, 8Dh        ; "5"
          dt        0F9h,0B6h,0B6h,0D6h,0E1h         ; "6"
          dt         9Fh,0AFh,0B7h,0B8h,0BFh         ; "7"
          dt        0C9h,0B6h,0B6h,0B6h,0C9h         ; "8"
          dt        0C3h,0B5h,0B6h,0B6h,0CFh        ; "9"
          dt        0FFh,0FFh,0C9h,0C9h,0FFh        ; ":"

;-------- Init -------
Init    movlw 03h        
        tris PORTA        ; RA0=sync(input), RA1=remote(input), RA2=motor(output)
        clrw               
        tris PORTB        ; RB0-RB7=LEDs(all output)        
Var_ini     clrf coln
               clrf digit
        movlw    0FFh
        movwf    PORTB
        bsf        temp,0
        return
               
;-------- Processing -------
Proc  btfss PORTA,0      ; sync
         bcf temp,0
         return

;-------- Display -------
Disp  btfsc temp,0
         return
La     movf    coln,0
        addwf   digit,0
        movwf   tot
        xorlw    36h
        btfsc    STATUS,Z
        goto     Var_ini
        movf     tot,0
        call      Table   

        movwf  PORTB
        call      Di           ; short delay
        incf      coln,1
        movf     coln,0
        xorlw    5h
        btfss    STATUS,Z
        goto     La
        movlw   5h
        addwf   digit,1
        clrf       coln
        call      Sp
        goto     La

Sp    movlw   0FFh        ; spacing
        movwf   PORTB
        call       Daa          ; long delay
        return      

;-------- Delay ------------
Daa    movlw   0AFh      ; long delay daa
          goto     Delay
Di       movlw   01Fh      ; short delay di
Delay  movwf   i
Loop   decfsz   i,1
          goto      Loop               
          return                        

;-------- Update -------
Update    nop   
              return

;  --------  Main  -----------
Main       call Init        ; init
Run        call Proc      ; processing
              call Disp      ; display
             call Update   ; Update
             goto Run
          end
     
 楼主| 发表于 2008-5-11 16:51:56 | 显示全部楼层
[第二步] 能显示时间 12:00AM

jled009.jpg
     
 楼主| 发表于 2008-5-11 17:11:07 | 显示全部楼层
程序(试验2) ... 时钟格式显示,能根据Variable hr和min的数据显示时间12:00AM ~ 11:59PM, 但还不能走时. ... 表数据增加A,P,M,改写的DISP摸块如下:

[C:\JLED\JledDisp.asm]
发表于 2008-5-15 11:11:53 | 显示全部楼层
厉害格!这和市面上的一种发光棒原理是一样的,视觉暂留。
发表于 2008-5-15 23:12:40 | 显示全部楼层
太厉害了,向你致敬!
     
 楼主| 发表于 2008-5-17 02:24:40 | 显示全部楼层
谢谢绿洲和法拉利!         .
     
 楼主| 发表于 2008-5-17 02:36:34 | 显示全部楼层
Disp摸块(上次没传好,重传)
;-------- Display -------
Disp btfsc        temp,0            ; been sync
        return
        movlw      0Dh
        call         See        
        movlw      0Bh        
        btfss        hr,7                ; check AM/PM
        movlw      0Ch        
        call         See                 ; see AM/FM
        movf        min,0        
        call         See                 ; see minute
        swapf      min,0        
        call         See                 ; see 10minute
        movlw      0Ah        
        call         See                 ; see ":"
        movf        hr,0        
        call         See                 ; see hours
        movlw     1h        
        btfsc       hr,4               
        call         See                 ; see 10hr
        goto        Dim                ; dim
See  andlw       0Fh                ; sub routine
        movwf        j         
        addwf        j,1        
        addwf        j,0        
        addwf        j,1                ; index processing
La    movf          n,0
        addwf        j,0               
        call        Table                ; get the pattern
        movwf     PORTB            ; display
        call        Di               
        decfsz    n,1                   ; check done
        goto       La
        call        Dim                  ; dim

        return
您需要登录后才可以回帖 登录 | 加入会员

本版积分规则

小黑屋|手机版|矿石收音机 ( 蒙ICP备05000029号-1 )

蒙公网安备 15040402000005号

GMT+8, 2024-6-17 07:56

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表