Searching \ for 'Random LED Flasher' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/method/math.htm?key=random
Search entire site for: 'Random LED Flasher'.

Truncated match.
PICList Thread
'Random LED Flasher'
1998\11\14@015226 by James Cameron

flavicon
face
part 0 4137 bytes
Here it is.  Please be gentle, I'm a novice on PICs.  ;-)

Briefly;

       - twenty four bit random number generator, derived from Scott
         Edwards Parallax RANDOM code on the Dontronics site,

       - five outputs, masked with a counter, to yield five frequencies
         of random flashes,

       - SLEEPs and uses the WDT to wake, 1:16 prescaler.

--
James Cameron                                      (spam_OUTcameronTakeThisOuTspamstl.dec.com)

OpenVMS, Linux, Firewalls, Software Engineering, CGI, HTTP, X, C, FORTH,
COBOL, BASIC, DCL, csh, bash, ksh, sh, Electronics, Microcontrollers,
Disability Engineering, Netrek, Bicycles, Pedant, Farming, Home Control,
Remote Area Power, Greek Scholar, Tenor Vocalist, Church Sound, Husband.

"Specialisation is for insects." -- Robert Heinlein.


proto   equ     0               ; we are prototyping on 16F84
                               ; change to zero for final burn

       if      proto == 1
       processor 16f84
       list    f=inhx8m
       include "p16f84.inc"
       __CONFIG        _CP_OFF & _WDT_ON & _HS_OSC
       else
       processor 12c509
       list    f=inhx8m
       include "p12c509a.inc"
       __CONFIG        _MCLRE_OFF & _CP_OFF & _WDT_ON & _IntRC_OSC
       endif

                               ; general purpose register allocation

                               ; first common free address as per
                               ; p12 of 12c509 spec
                               ; p13 of 16f84 spec

beat    equ     0x0c
ranl    equ     0x0d
ranm    equ     0x0e
ranh    equ     0x0f

       if      proto == 1      ; which port to use
port    equ     PORTB
       else
port    equ     GPIO
       endif

m_input equ     b'00000000'     ; input mask, which bits are input

       org     0x00            ; reset vector
       if      proto != 1
       movwf   OSCCAL          ; store oscillator calibration
       endif
       goto    main

       dt      "ax6 1998-10-11 .....james.cameronKILLspamspam@spam@digital.com flasher"

reinitialise:                   ; set up ports
       if      proto == 1      ; are we on 16f84?
       clrf    TMR0
       bsf     STATUS,RP0      ; select register bank 1
       clrwdt
       movlw   b'11111100'     ; assign 1:16 prescaler to WDT
       movwf   OPTION_REG
       bsf     STATUS,RP0
       movlw   m_input
       movwf   TRISB
       bcf     STATUS,RP0
       else                    ; otherwise 12c509
       clrwdt
       clrf    TMR0
       movlw   b'11011100'     ; assign 1:16 prescaler to WDT
       option                  ; ... and disabled TOCS
       movlw   m_input
       tris    GPIO
       endif
       retlw   0

initialise:                     ; clear the random number seed
       movlw   0xa5
       movwf   ranh
       movwf   ranm
       movwf   ranl
       retlw   0

alive:                          ; update the LED drivers
       incf    beat,f
       movf    beat,w
       andwf   ranl,w
       movwf   port
       retlw   0

random:                         ; find next random number
       movf    ranl,w          ; check total value zero
       iorwf   ranh,w
       btfsc   STATUS,Z
       comf    ranh,f          ; invert some bits if so
       movlw   0x80
       btfsc   ranh,6
       xorwf   ranh,f
       btfsc   ranh,4
       xorwf   ranh,f
       btfsc   ranl,3
       xorwf   ranh,f
       bcf     STATUS,C        ; clear the carry flag
       btfsc   ranh,7          ; if the high bit is set ...
       bsf     STATUS,C        ; ... set also the carry flag
       rlf     ranl,f
       rlf     ranm,f
       rlf     ranh,f
       retlw   0

main:
       btfsc   STATUS,NOT_TO   ; if this is a reset or power-up ...
       call    initialise      ; ... clear random number seed
       call    reinitialise    ; set port drivers and WDT prescaler

main_1:
       call    alive           ; update LED outputs
       call    random          ; find next random number
       sleep                   ; sleep for next WDT wakeup
       goto    main_1

       end



'Random LED Flasher'
1998\12\12@134224 by Craig Lee
flavicon
face
It would make a good vibrator controller for a comfy chair too.....


-----Original Message-----
From: James Cameron <cameronspamKILLspamSTL.DEC.COM>
To: .....PICLISTKILLspamspam.....MITVMA.MIT.EDU <EraseMEPICLISTspam_OUTspamTakeThisOuTMITVMA.MIT.EDU>
Date: Friday, November 13, 1998 10:53 PM
Subject: Random LED Flasher


{Quote hidden}

1998\12\12@154646 by Andy Stephenson

flavicon
face
...a comfy chair? yeh right!
At 11:45 12/12/98 -0700, you wrote:
>It would make a good vibrator controller for a comfy chair too.....
>
>
>{Original Message removed}

More... (looser matching)
- Last day of these posts
- In 1998 , 1999 only
- Today
- New search...