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:
Search entire site for: 'Random LED Flasher'.

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

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


       - 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                                      (

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 ""
       __CONFIG        _CP_OFF & _WDT_ON & _HS_OSC
       processor 12c509
       list    f=inhx8m
       include ""
       __CONFIG        _MCLRE_OFF & _CP_OFF & _WDT_ON & _IntRC_OSC

                               ; 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
port    equ     GPIO

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

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

       dt      "ax6 1998-10-11 flasher"

reinitialise:                   ; set up ports
       if      proto == 1      ; are we on 16f84?
       clrf    TMR0
       bsf     STATUS,RP0      ; select register bank 1
       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
       clrf    TMR0
       movlw   b'11011100'     ; assign 1:16 prescaler to WDT
       option                  ; ... and disabled TOCS
       movlw   m_input
       tris    GPIO
       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

       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

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


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

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

{Quote hidden}

1998\12\12@154646 by Andy Stephenson

...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...