This project uses the “18 LED Display-1”
;18LED12F629.asm ;STRESS with secret program when touching touch pads on start-up ;This program creates a display on 18 LEDs 1-1-2006 ;LED pattern corresponds to PC board list p=12F629 radix dec include "p12f629.inc" __CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF & _INTRC_OSC_NOCLKOUT ;Internal osc. ; globals soundhigh equ 20h ;this is the first available file soundlow equ 21h fileA equ 26h ;delay fileA fileB equ 27h ;delay fileB fileC equ 28h ;delay fileC delA equ 36h delB equ 37h long_delC equ 38h short_delD equ 39h beeplength equ 3Ah ;length of beep beephigh equ 3Bh ;HIGH time beeplow equ 3Ch ;LOW time tmr0 equ 01h randomNo equ 3Dh temp equ 3Eh ;temporary file for decrementing tempRand equ 3Fh status equ 03h OPTION_REG equ 81h osccal equ 90h ; bits on GPIO lineA equ 0 ;GP0 lineB equ 1 ;GP1 lineC equ 2 ;GP2 input equ 3 ;GP3 lineD equ 4 ;GP4 lineE equ 5 ;GP5 ;bits rp0 equ 5 Start org 0x00 ;program starts at location 000 nop nop nop nop ;NOPs to get past reset vector address nop nop SetUp clrf GPIO ;clear port of junk movlw 0x24 movwf osccal ;calibrate oscillator movlw 2Fh ;put 0010 1111 into W andwf tmr0,0 ;mask bits to get max 0010 1111 for table jump movwf randomNo ;move number to Random Number file movlw b'11111111' ;This will make GP3 input tris 05h btfss GPIO,3 goto Main1 goto New ;Random Number Table Table1 addwf 02,1 retlw 05 retlw 07 retlw 06 retlw 04 retlw 02 retlw 0Bh retlw 01 retlw 12h retlw 0Ch retlw 10h retlw 11h retlw 09h retlw 0Ah retlw 06h retlw 0Bh retlw 0Dh retlw 12h retlw 01 retlw 12h retlw 09 retlw 08 retlw 07 retlw 0Dh retlw 06 retlw 0Fh retlw 08 retlw 0Bh retlw 05 retlw 07 retlw 0Ah retlw 11h retlw 0Ah retlw 11h retlw 02 retlw 0Dh retlw 06 retlw 02 retlw 01 retlw 0Bh retlw 12h retlw 06 retlw 07 retlw 0Eh retlw 05 retlw 0Eh retlw 0Ch retlw 04 retlw 09 retlw 0Eh retlw 10h retlw 0Bh retlw 11h retlw 03 retlw 04 retlw 0Eh retlw 07 retlw 0Ah retlw 03 retlw 11h retlw 05 retlw 0Fh retlw 02 retlw 0Dh retlw 0Dh retlw 02 retlw 08 retlw 0Fh retlw 01 retlw 0Fh retlw 0Ch retlw 12h retlw 04 retlw 05 retlw 0Fh retlw 08 retlw 09 retlw 10h retlw 01 retlw 03 retlw 10h retlw 04 retlw 03 retlw 0Eh retlw 03 retlw 0Ch retlw 10h retlw 0FFh Around1 call Beep call LED1 call Del_1 call Beep call LED2 call Del_1 call Beep call LED3 call Del_1 call Beep call LED4 call Del_1 call Beep call LED5 call Del_1 call Beep call LED6 call Del_1 call Beep call LED7 call Del_1 call Beep call LED8 call Del_1 call Beep call LED9 call Del_1 call Beep call LED10 call Del_1 call Beep call LED11 call Del_1 call Beep call LED12 call Del_1 call Beep call LED13 call Del_1 call Beep call LED14 call Del_1 call Beep call LED15 call Del_1 call Beep call LED16 call Del_1 call Beep call LED17 call Del_1 call Beep call LED18 call Del_1 retlw 00 Around2 nop Around3 call Beep call LED1 call Del_2 call Beep call LED2 call Del_2 call Beep call LED3 call Del_2 call Beep call LED4 call Del_2 call Beep call LED5 call Del_2 call Beep call LED6 call Del_2 call Beep call LED7 call Del_2 call Beep call LED8 call Del_2 call Beep call LED9 call Del_2 call Beep call LED10 call Del_2 call Beep call LED11 call Del_2 call Beep call LED12 call Del_2 call Beep call LED13 call Del_2 call Beep call LED14 call Del_2 call Beep call LED15 call Del_2 call Beep call LED16 call Del_2 call Beep call LED17 call Del_2 call Beep call LED18 call Del_2 retlw 00 Around4 call Beep call LED1 call Del_3 decfsz tempRand,1 goto A2 goto show A2 call Beep call LED2 call Del_3 decfsz tempRand,1 goto A3 goto show A3 call Beep call LED3 call Del_3 decfsz tempRand,1 goto A4 goto show A4 call Beep call LED4 call Del_3 decfsz tempRand,1 goto A5 goto show A5 call Beep call LED5 call Del_3 decfsz tempRand,1 goto A6 goto show A6 call Beep call LED6 call Del_3 goto show A7 call Beep call LED7 call Del_3 decfsz tempRand,1 goto A8 goto show A8 call Beep call LED8 call Del_3 decfsz tempRand,1 goto A9 goto show A9 call Beep call LED9 call Del_3 decfsz tempRand,1 goto A10 goto show A10 call Beep call LED10 call Del_3 decfsz tempRand,1 goto A11 goto show A11 call Beep call LED11 call Del_3 decfsz tempRand,1 goto A12 goto show A12 call Beep call LED12 call Del_3 decfsz tempRand,1 goto A13 goto show A13 call Beep call LED13 call Del_3 decfsz tempRand,1 goto A14 goto show A14 call Beep call LED14 call Del_3 decfsz tempRand,1 goto A15 goto show A15 call Beep call LED15 call Del_3 decfsz tempRand,1 goto A16 goto show A16 call Beep call LED16 call Del_3 goto show Beep movlw b'11111110' tris 05h ;make GPO output movlw 020h movwf beeplength Beep1 bsf GPIO,0 ;Piezo HIGH movlw 80h movwf beephigh Beep2 nop decfsz beephigh,1 goto Beep2 bcf GPIO,0 movlw 80h movwf beeplow ;Piezo LOW Beep3 nop decfsz beeplow,1 goto Beep3 decfsz beeplength,1 goto Beep1 retlw 00 ;Delay 1 Del_1 movlw 20h movwf fileB DelX decfsz fileA,1 ; ,1 denotes the result of the decrement goto DelX decfsz fileB,1 goto DelX retlw 00 ;Delay 2 Del_2 incf fileC incf fileC incf fileC incf fileC incf fileC movf fileC,0 movwf fileB DelY decfsz fileA,1 ; ,1 denotes the result of the decrement goto DelY decfsz fileB,1 goto DelY retlw 00 ;Delay 3 Del_3 incf fileC incf fileC incf fileC incf fileC movf fileC,0 movwf fileB DelZ nop nop nop nop decfsz fileA,1 ; ,1 denotes the result of the decrement goto DelZ decfsz fileB,1 goto DelZ retlw 00 ;Activating the LEDs: LED1 movlw b'11111100' ;Put into W to turn on LED 1 tris 05h movlw b'00000001' movwf 05h ;make GP0 HIGH make GP1 LOW retlw 00 LED2 movlw b'11111100' ;Put into W to turn on LED 2 tris 05h movlw b'00000010' movwf 05h ;make GP0 LOW make GP1 HIGH retlw 00 LED3 movlw b'11011110' ;Put into W to turn on LED 3 tris 05h movlw b'00100000' movwf 05h ;make GP1 LOW make GP5 HIGH retlw 00 LED4 movlw b'11011110' ;Put into W to turn on LED 4 tris 05h movlw b'00000001' movwf 05h ;make GP1 LOW make GP5 HIGH retlw 00 LED5 movlw b'11011011' ;Put into W to turn on LED 5 tris 05h movlw b'00100000' movwf 05h ;make GP2 LOW make GP5 HIGH retlw 00 LED6 movlw b'11011011' ;Put into W to turn on LED 6 tris 05h movlw b'00000100' movwf 05h ;make GP2 HIGH make GP5 LOW retlw 00 LED7 movlw b'11101011' ;Put into W to turn on LED 7 tris 05h movlw b'00010000' movwf 05h ;make GP2 LOW make GP4 HIGH retlw 00 LED8 movlw b'11101011' ;Put into W to turn on LED 8 tris 05h movlw b'00000100' movwf 05h ;make GP2 HIGH make GP4 LOW retlw 00 LED9 movlw b'11101101' ;Put into W to turn on LED 9 tris 05h movlw b'00010000' movwf 05h ;make GP1 LOW make GP4 HIGH retlw 00 LED10 movlw b'11101101' ;Put into W to turn on LED 10 tris 05h movlw b'00000010' movwf 05h ;make GP1 LOW make GP5 HIGH retlw 00 LED11 movlw b'11001111' ;Put into W to turn on LED 11 tris 05h movlw b'00100000' movwf 05h ;make GP4 LOW make GP5 HIGH retlw 00 LED12 movlw b'11001111' ;Put into W to turn on LED 12 tris 05h movlw b'00010000' movwf 05h ;make GP4 HIGH make GP5 LOW retlw 00 LED13 movlw b'11011101' ;Put into W to turn on LED 13 tris 05h movlw b'00100000' movwf 05h ;make GP1 LOW make GP5 HIGH retlw 00 LED14 movlw b'11011101' ;Put into W to turn on LED 14 tris 05h movlw b'00000010' movwf 05h ;make GP1 HIGH make GP5 LOW retlw 00 LED15 movlw b'11111001' ;Put into W to turn on LED 15 tris 05h movlw b'00000010' movwf 05h ;make GP1 HIGH make GP2 LOW retlw 00 LED16 movlw b'11111001' ;Put into W to turn on LED 16 tris 05h movlw b'00000100' movwf 05h ;make GP1 LOW make GP2 HIGH retlw 00 LED17 movlw b'11111010' ;Put into W to turn on LED 17 tris 05h movlw b'00000001' movwf 05h ;make GP0 HIGH make GP2 LOW retlw 00 LED18 movlw b'11111010' ;Put into W to turn on LED 18 tris 05h movlw b'00000100' movwf 05h ;make GP0 LOW make GP2 HIGH retlw 00 New call sound ;this is where your new program is placed call Del_1 goto New show movlw 40h movwf long_delC show2 call Del_1 decfsz long_delC goto show2 retlw 00 sound movlw b'11111110' tris 05h ;make GPO output movlw 0F0h movwf temp sound1 bsf GPIO,0 ;Piezo HIGH movf temp,0 ; movwf soundhigh sound2 nop nop nop nop nop decfsz soundhigh,1 goto sound2 bcf GPIO,0 movf temp,0 movwf soundlow ;Piezo LOW sound3 nop nop nop nop nop decfsz soundlow,1 goto sound3 decfsz temp,1 goto sound1 retlw 00 Main incf randomNo ; call sound call sound call Del_3 movlw b'11111111' ;make all lines "input" to turn off LEDs tris 05h Main1 call Beep call Del_3 call Beep call Del_3 call Del_3 movlw b'11111111' ;This will make GP3 input tris 05h btfss GPIO,3 goto Main1 Main2 movf randomNo,0 ;move random number to W call Table1 movwf tempRand ;put LED number into temp file for decrementing xorlw 0FFh ;end of table? btfsc 03,2 goto Main3 goto Main4 Main3 clrf randomNo incf randomNo goto Main2 Main4 call Around1 movlw 30h movwf fileC call Around2 call Around3 movlw 50h ;create delay for final loop of display movwf fileC call Around4 call sound goto Main ;OSCCAL calibration value org 0x3ff movlw 0x24 end
Quick Links
Legal Stuff
Social Media