31
Experiment-8 for "5x7 Display" Project ;PIC16F84 and only F84 chip ;Column of LEDs moves across and back Start ORG 0x00 BSF 03,5 ;Go to page1 for setting-up the ports MOVLW 00h ;Put 00 into W MOVWF 05h ;Make all RA lines output MOVWF 06h ;Make all RB lines output BCF 03,5 ;Go to Page0 for programming Shift MOVLW 05 MOVWF 19h ;Put 5 in the Count file for 5 columns BSF 05h,1 ;Reset 4017 BCF 05h,1 ;allow 4017 to clock via clock line Shift1 MOVLW 7F MOVWF 06h ;Turn on 7 outputs for LEDs CALL Delay MOVLW 00 ;Turn off LEDs to prevent mirroring MOVWF 06h CALL Clock ;Clock the 4017 DECFSZ 19h,1 ;Decrement the count file GOTO Shift1 MOVLW 03h MOVWF 19h ;3 shifts - yes 3 shifts! AAA CALL Back DECFSZ 19h,1 GOTO AAA GOTO Shift Back BSF 05h,1 BCF 05h,1 ;Reset 4017 and allow 4017 to clock MOVLW 00h MOVWF 06h ;Turn off LEDs to prevent "streaking" MOVF 19h,0 ;Copy 19h into W MOVWF 18h ;Copy W into file 18h BBB CALL Clock DECFSZ 18h,1 GOTO BBB MOVLW 7Fh MOVWF 06h ;Turn on all 7 LEDs CALL Delay RETURN Clock BCF 05,0 ;Clock the 4017 NOP BSF 05,0 RETURN Delay MOVLW 03 MOVWF 1Ah Delay1 DECFSZ 1Bh,1 GOTO Delay1 DECFSZ 1Ch,1 GOTO Delay1 DECFSZ 1Ah,1 GOTO Delay1 RETURN

Talking electronics

Embed Size (px)

DESCRIPTION

electronica

Citation preview

Experiment-8for "5x7 Display" Project ;PIC16F84 and only F84 chip ;Column of LEDs moves across and back

Start ORG 0x00 BSF 03,5 ;Go to page1 for setting-up the ports MOVLW 00h ;Put 00 into W MOVWF 05h ;Make all RA lines output MOVWF 06h ;Make all RB lines output BCF 03,5 ;Go to Page0 for programmingShift MOVLW 05 MOVWF 19h ;Put 5 in the Count file for 5 columns BSF 05h,1 ;Reset 4017 BCF 05h,1 ;allow 4017 to clock via clock line

Shift1 MOVLW 7F MOVWF 06h ;Turn on 7 outputs for LEDs CALL Delay MOVLW 00 ;Turn off LEDs to prevent mirroring MOVWF 06h CALL Clock ;Clock the 4017 DECFSZ 19h,1 ;Decrement the count file GOTO Shift1

MOVLW 03h MOVWF 19h ;3 shifts - yes 3 shifts!AAA CALL Back DECFSZ 19h,1 GOTO AAA GOTO Shift

Back BSF 05h,1 BCF 05h,1 ;Reset 4017 and allow 4017 to clock MOVLW 00h MOVWF 06h ;Turn off LEDs to prevent "streaking" MOVF 19h,0 ;Copy 19h into W MOVWF 18h ;Copy W into file 18hBBB CALL Clock DECFSZ 18h,1 GOTO BBB MOVLW 7Fh MOVWF 06h ;Turn on all 7 LEDs CALL Delay RETURN

Clock BCF 05,0 ;Clock the 4017 NOP BSF 05,0 RETURN

Delay MOVLW 03 MOVWF 1AhDelay1 DECFSZ 1Bh,1 GOTO Delay1 DECFSZ 1Ch,1 GOTO Delay1 DECFSZ 1Ah,1 GOTO Delay1 RETURN

END

Experiment-9for "5x7 Display" Project ;PIC16F84 and only F84 chip ;Column of LEDs moves across/back then up and down

Start ORG 0x00 BSF 03,5 ;Go to page1 for setting-up the ports MOVLW 00h ;Put 00 into W MOVWF 05h ;Make all RA lines output MOVWF 06h ;Make all RB lines output BCF 03,5 ;Go to Page0 for programming GOTO Main

Back BSF 05h,1 BCF 05h,1 ;Reset 4017 and allow 4017 to clock MOVLW 00h MOVWF 06h ;Turn off LEDs to prevent "streaking" MOVF 19h,0 ;Copy 19h into W MOVWF 18h ;Copy W into file 18hBack1 CALL Clock DECFSZ 18h,1 GOTO Back1 MOVLW 7Fh MOVWF 06h ;Turn on all 7 LEDs CALL Delay RETURN

Scan MOVLW 080h ;Determines the number of scans before MOVWF 1Ch ; incrementing routineScan1 BSF 05h,1 ;Reset 4017 BCF 05h,1 ;allow 4017 to clock via clock line MOVLW 05h MOVWF 19h ;File 19h counts the number of columns

Scan2 CALL Short BCF 05,0 ;Clock the 4017 BSF 05,0 DECFSZ 19h,1 GOTO Scan2 DECFSZ 1Ch,1 GOTO Scan1 RETURN

Clock BCF 05,0 ;Clock the 4017NOPBSF 05,0RETURN

Delay MOVLW 03 MOVWF 1AhDelay1 DECFSZ 1Bh,1 GOTO Delay1 DECFSZ 1Ch,1 GOTO Delay1 DECFSZ 1Ah,1 GOTO Delay1 RETURN

;Short Delay

Short DECFSZ 1Bh,1GOTO ShortRETURN

;Moves a column of LEDs across the screen and back, ;then up and down the screen

Main MOVLW 05MOVWF 19h ;Put 5 in the Count file for 5 columnsBSF 05h,1 ;Reset 4017BCF 05h,1 ;allow 4017 to clock via clock lineMain1 MOVLW 7FMOVWF 06h ;Turn on 7 outputs for LEDsCALL DelayMOVLW 00 ;Turn off LEDs to prevent mirroringMOVWF 06hCALL Clock ;Clock the 4017DECFSZ 19h,1 ;Decrement the count fileGOTO Main1MOVLW 03hMOVWF 19h ;3 shifts - yes 3 shifts!Main2 CALL BackDECFSZ 19h,1GOTO Main2BSF 05h,1BCF 05h,1 ;Reset 4017CALL Delay ;This illuminates the first row!MOVLW 01MOVWF 06h ;Turn on first LEDBCF 03h,0 ;clear the carry flagMain3 CALL ScanRLF 06,1BTFSS 06,7 ;When 8th! output is HIGH, program repeatsGOTO Main3MOVLW 20hMOVWF 06hMain4 CALL ScanRRF 06,1BTFSS 06,0GOTO Main4CALL Scan ;This illuminates bottom row!GOTO Main

ENDExperiment-11for "5x7 Display" Project ;PIC16F84 and only F84 chip ; ELEVATOR DISPLAY

Start ORG 0x00 BSF 03,5 ;Go to page1 for setting-up the ports MOVLW 0Ch ;Put 0C into W MOVWF 05h ; to make RA2 & RA3 input MOVLW 00h ;Put 00 into W MOVWF 06h ;to make all RB lines output BCF 03,5 ;Go to Page0 for programming GOTO Main

Table1 ADDWF 02h,1 ;Add W to Program Counter RETLW 00h RETLW 0Eh ;9 RETLW 11h RETLW 11h RETLW 0Fh RETLW 01h RETLW 11h RETLW 0Eh RETLW 00h ;8 RETLW 0Eh RETLW 11h RETLW 11h RETLW 0Eh RETLW 11h RETLW 11h RETLW 0Eh RETLW 00h RETLW 1Fh ;7 RETLW 01h RETLW 02h RETLW 04h RETLW 08h RETLW 08h RETLW 08h RETLW 00h ;6 RETLW 0Eh RETLW 11h RETLW 10h RETLW 1Eh RETLW 11h RETLW 11h RETLW 0Eh RETLW 00h ;5 RETLW 1Fh RETLW 10h RETLW 10h RETLW 1Eh RETLW 01h RETLW 11h RETLW 0Eh RETLW 00h ;4 RETLW 02h RETLW 06h RETLW 0Ah RETLW 12h RETLW 1Fh RETLW 02h RETLW 02h RETLW 00h ;3 RETLW 0Eh RETLW 11h RETLW 01h RETLW 06h RETLW 01h RETLW 11h RETLW 0Eh RETLW 00h ;2 RETLW 0Eh RETLW 11h RETLW 01h RETLW 0Eh RETLW 10h RETLW 10h RETLW 1Fh RETLW 00h ;1 RETLW 04h RETLW 0Ch RETLW 14h RETLW 04h RETLW 04h RETLW 04h RETLW 04h RETLW 00h ;G RETLW 0Eh RETLW 11h RETLW 10h RETLW 17h RETLW 11h RETLW 11h RETLW 00h RETLW 00h

;Ghost routine transfers data from the ; Ghost files to the Video Screen ; and scans the Video Screen ONCE

Ghost BSF 05,1 ;Reset 4017 NOP BCF 05,1 MOVF 11h,0 ;Move the data from the MOVWF 06h ; Ghost files to CALL DelA ; the output port MOVF 12h,0 ; and call a Delay so theMOVWF 06h ; LED can be illuminated CALL DelAMOVF 13h,0MOVWF 06hCALL DelAMOVF 14h,0MOVWF 06hCALL DelAMOVF 15h,0MOVWF 06hCALL DelARETURN

DelA DECFSZ 1Bh,1GOTO DelAMOVLW 00hMOVWF 06

Clk BCF 05,0 ;Clock the 4017 to theNOP ; next outputBSF 05,0RETURN

;FillTop moves the 5 Ghost locations down one bit ; and fills the top row with new data. ;File 16h contains the new data for the 5 locations

FillTop RRF 11h,1 ;Move each bit down the fileRRF 12h,1 ; to make room at the topRRF 13h,1RRF 14h,1RRf 15h,1BCF 11h,6 ;Clear bit 6 in each file = 7th row of LEDsBCF 12h,6 ; on the Video Screen.BCF 13h,6BCF 14h,6BCF 15h,6BTFSS 16h,4 ;See if bit4 (the 5th bit) is 0 or 1GOTO L ;If it's 0, go to the next testBSF 11h,6 ;If it's 1, set bit 6 of the Ghost fileL BTFSS 16h,3GOTO MBSF 12h,6M BTFSS 16h,2 ;File 16h was generated by adding thr value ofGOTO N ; of each pixel in the row of each numberBSF 13h,6 ; see Table1 and diagram 1 for details.N BTFSS 16h,1GOTO OBSF 14h,6O BTFSS 16h,0RETURNBSF 15h,6RETURN

FilBott RLF 11h,1 ;Same principle as above, but this timeRLF 12h,1 ; the bits in the file are moved up toRLF 13h,1 ; leave a gap at the bottom.RLF 14h,1RLF 15h,1BCF 11h,0 ;Clear the lowest bit of each Ghost fileBCF 12h,0BCF 13h,0BCF 14h,0BCF 15h,0BTFSS 16h,4GOTO PBSF 11h,0P BTFSS 16h,3GOTO QBSF 12h,0Q BTFSS 16h,2GOTO RBSF 13h,0R BTFSS 16h,1GOTO SBSF 14h,0S BTFSS 16h,0RETURNBSF 15h,0RETURN

;FilGho fills the Ghost area with 7 rows of "G" data ;from Table1

FilGho MOVLW 08MOVWF 1A ;1A is count file for 7 cycles of "FilGho"MOVLW 58hMOVWF 19h ;File19h is button B pointer for Table1MOVLW 50h ;Jump down table1 50h locationsMOVWF 17h ;file17h is button A pointer for Table1FilGho1 CALL Table1MOVWF 16hCALL FillTopDECF 17h,1 ;File 17h is the table pointer for button ADECF 19h,1 ;File 19h is the table pointer for button BMOVF 17h,0 ;Put pointer into WDECFSZ 1A,1GOTO FilGho1RETURN

;MAIN ROUTINE

Main CALL FilGho ;Put "G" on screenCALL Ghost ;Display whatever is in Ghost filesBTFSC 05h,2 ;Test for button AGOTO Main2 ;PushedGOTO Main

Main2 MOVLW 08MOVWF 1AMain3 MOVLW 20hMOVWF 18h ;File 18h holds number of scans before adding next rowMain4 CALL GhostDECFSZ 18h,1GOTO Main4MOVF 17h,0 ;Put table1 pointer into WCALL Table1MOVWF 16hCALL FillTopDECF 17h,1DECF 19h,1;19h is pointer for button BDECFSZ 1A,1 GOTO Main3Main5 CALL Ghost ;Display whatever is in Ghost filesBTFSC 05h,2 ;Test for button AGOTO MainA ;Button A PushedBTFSC 05h,3 ;Test for Button BGOTO MainB ;Button B pushedGOTO Main5

MainA MOVF 17h,0 ;Copy 17h into WXORLW 00hBTFSC 03,2 ;Button A not to work. On floor 9!GOTO Main5GOTO Main2MainB MOVF 19h,0 ;Copy 19h into WXORLW 50hBTFSC 03,2 ;Button B not to work. On G floor!GOTO Main5Main6 MOVLW 08MOVWF 1AhMain7 MOVLW 20hMOVWF 18h ;File 18h holds the number of scans before addingnext rowMain8 CALL GhostDECFSZ 18h,1GOTO Main8MOVF 19h,0 ;Put table1 pointer into W CALL Table1MOVWF 16hCALL FilBottINCF 17h,1INCF 19h,1 ;19h is pointer for button BDECFSZ 1A,1GOTO Main7GOTO Main5

END

Experiment-13for "5x7 Display" Project ;PIC16F84 and only F84 chip ; 0-9 Up Counter

Start ORG 0x00 BSF 03,5 ;Go to page1 for setting-up the ports MOVLW 0Ch ;Put 0C into W MOVWF 05h ; to make RA2 & RA3 input MOVLW 00h ;Put 00 into W MOVWF 06h ;to make all RB lines output BCF 03,5 ;Go to Page0 for programming GOTO Main

Table1 ADDWF 02h,1 ;Add W to Program Counter RETLW 3Eh ;0 RETLW 41h RETLW 41h RETLW 41h RETLW 3Eh RETLW 00h ;1 RETLW 10h RETLW 20h RETLW 7Fh RETLW 00h RETLW 27h ;2 RETLW 49h RETLW 49h RETLW 49h RETLW 31h RETLW 22h ;3 RETLW 41h RETLW 49hRETLW 49h RETLW 36h RETLW 0Ch ;4 RETLW 14h RETLW 24h RETLW 7Fh RETLW 04h RETLW 7Ah ;5 RETLW 49h RETLW 49h RETLW 49h RETLW 46h RETLW 3Eh ;6 RETLW 49h RETLW 49h RETLW 49h RETLW 26h RETLW 40h ;7 RETLW 47h RETLW 48h RETLW 50h RETLW 60h RETLW 36h ;8 RETLW 49h RETLW 49h RETLW 49h RETLW 36h RETLW 32h ;9 RETLW 49h RETLW 49h RETLW 49h RETLW 3Eh RETLW 00h

;Ghost routine transfers data from the Ghost files to the Video Screen ; and scans the Video Screen ONCE

Ghost BSF 05,1 ;Reset 4017 NOP BCF 05,1 MOVF 11h,0 ;Move the data from the MOVWF 06h ; Ghost files to CALL DelA ; the output port MOVF 12h,0 ; and call a Delay so the MOVWF 06h ; LED can be illuminated CALL DelA MOVF 13h,0 MOVWF 06h CALL DelA MOVF 14h,0 MOVWF 06h CALL DelA MOVF 15h,0 MOVWF 06h CALL DelA RETURN

DelA DECFSZ 1Bh,1 GOTO DelA MOVLW 00h MOVWF 06Clk BCF 05,0 ;Clock the 4017 to the NOP ; next output BSF 05,0 RETURN

;"FillGh" Fill moves 5 bytes of data from Table1 to ; to Ghost area via Indirect Addressing

FillGh MOVLW 05 MOVWF 18h ;5 cycles of Loading MOVLW 11h MOVWF 04 ;Move start of Ghost locations to FSRFillGh2 MOVF 17h,0 ;Move table pointer to W CALL Table1 MOVWF 00 ;Move W to INDF (move into what FSR looks at) INCF 04h,1 ;Increment the FSR to look at next file INCF 17h,1 DECFSZ 18h,1 GOTO FillGh2RETURN

;MAIN ROUTINE

Main MOVLW 00 MOVWF 17h ;Load Table1 pointer with 00 CALL FillGh ;Put "0" on ScreenMain1 BCF 1E,5Main2 CALL Ghost ;Display whatever is in Ghost files BTFSC 05h,2 ;Test for buttonA GOTO Main3 ;Pushed GOTO Main1 ;Not pushed

Main3 BTFSC 1E,5 GOTO Main2 MOVF 17h,0 ;Has pointer reached end of table? XORLW 32h ;End of Table is 32h bytes. BTFSS 03,2 ;Test the zero flag GOTO Main4 MOVLW 00 MOVWF 17hMain4 CALL FillGh ;No. Put next number on screen BSF 1E,5 ;Set the button flag GOTO Main2

END

EXPERIMENTO-17ANIMATION-1En un experimento anterior mostramos cmo desplazar palabras a travs de la pantalla.En este experimento vamos un paso ms all y mostrar cmo crear una animacin en la pantalla.La animacin es la base para la caricatura.Una caricatura se compone de un montn de cuadros llamados clulas.Estos son individualmente dibujadas a mano (o computadora) y un dibujo animado de buena calidad requiere de 12 clulas por segundo.Esto significa que una pelcula de 1 hora de dibujos animados de larga duracin requiere ms de 400.000.Cada clula se "dispar dos veces" porque la pelcula de pelcula requiere de 24 fotogramas por segundo.Nuestra Display 5x7 es mucho ms simple.Se compone de 35 puntos o pxeles y cuando la pantalla muestra una "imagen", se llama una clula.Primero vamos a mostrar cmo hacer que una clula y cmo mostrarlo en la pantalla de video para aproximadamente 1/10th de un segundo .Esto significa que usted necesitar producir 10 clulas por cada segundo de animacin.Dependiendo del efecto, puede una clula de tasa o velocidad de fotogramas, desde slo 1 fotograma por segundo o tan alto como 10 fotogramas por segundo.pelculade dibujos animados de larga duracin requiere ms de 400.000.Cada clula se "dispar dos veces" porque la pelcula de pelcula requiere de 24 fotogramas por segundo.HACIENDO UNA CLULACada dibujo o elemento se compone de 5x7 puntos (= 35 pxeles) y lo primero que debe hacer es llamar a cada uno de los fotogramas de la animacin en un "piso de a bordo."El siguiente diagrama muestra tres clulas.La primera celda est en blanco.Se muestra cmo cada uno de los 35 pxeles tiene un valor hexadecimal y nmero de expediente.La primera columna tiene 7 espacios que representan los primeros 7 LEDs en la pantalla.Estos LED tienen valores a partir de 01 para el LED inferior, a continuacin, 02, 04, 08, 10, 20 y la parte superior del LED tiene el valor 40.Estos valores corresponden a

los 7 primeros lugares en 11h archivos.La ubicacin en el archivo de octava (valor 80h) no se utiliza en este proyecto.La segunda columna corresponde a presentar 12h, entonces el archivo 13h, 14h y 15h.Para encender un LED particular, el valor hexadecimal correspondiente debe ser colocado en uno de los archivos.Cada archivo tendr un valor de 00 a 7F.Es realmente muy simple cuando se sabe cmo.Los ltimos 4 LEDs se suman para obtener un valor de entre 00 y 0F, mientras que los tres LEDs se suman para obtener un valor de entre 00 y 70 aos.Estos dos valores se unen para obtener un valor de 00 a 7F.En la primera columna del Ejemplo 1, los LED 8 y 4 estn obligados a ser iluminada (nos ocupamos de los cuatro LEDs inferiores primero).Los valores hexadecimales quince son: 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.LED de 08 y 04 = nueve, A, B, C = C = 0 C.Para encender la primera columna del ejemplo 1, 11h archivo se carga con 1C.Para activar la segunda columna: 08 + 04 + 02 = nueve, A, B, C, D, E, = 0E Los dos LEDs son 20 + 40 = 60.12h archivo se carga con 6E.Para activar la tercera columna: 08 + 01 = 09 10 + 20 = 30.13h archivos deben cargarse con 39h.Para activar la cuarta columna: 14h archivos deben cargarse con 04Para activar las 15h del archivo quinta columna deben ser cargados con 55hPor Ejemplo 2:11h archivos deben cargarse con 22h12h archivo debe cargarse con 1EH13h archivo debe ser cargado con 07h14h archivo debe ser cargado con 71h15h archivo debe ser cargado con 7FhLa letra pequea "h" indica el nmero es hexadecimal como "22" puede ser un nmero "normal - veintids - o un hexadecimal 22 -. igual a treinta y cuatro. El ltimo paso es decidir la duracin de cada marco se ha fijado en un valor predeterminado de 2 fotogramas por segundo puede ejecutar la animacin y cambiar cualquiera de los valores en cualquier momento..Puede aadir o eliminar un marco en cualquier momento. Para aadir un marco simplemente colquelo en el programa en el lugar donde quieras que aparezca y darle un nombre. Los marcos no tienen que ser contados. Simplemente se coloca en el programa y a su publicacin en ese orden.Este es el programa para visualizar el ejemplo 1 (arriba) en la pantalla durante 1/2sec. Tendr que reiniciar el micro despus de que el programa ha mostrado la imagen de 1/2 seg. Deslice el largo / reset: selector de programas a pgm despus de ejecutar / reset para ver el programa de nuevo.

Experiment-17for "5x7 Display" Project ;PIC16F84 and only F84 chip ;Display example1 for 1/2 sec:

Start ORG 0x00BSF 03,5 ;Go to page1 for setting-up the portsMOVLW 00h ;Put 00 into WMOVWF 05h ;to make port 5 (port A) all outputMOVWF 06h ;and make port 6 (port B) all outputBCF 03,5 ;Go to page0 for programmingGOTO Main

Frame1 MOVLW 1Ch ;place the 5 values into the 5MOVWF 11h ; files to produce the patternMOVLW 6Eh ; shown in example1 above.MOVWF 12hMOVLW 39hMOVWF 13hMOVLW 04hMOVWF 14hMOVLW 55hMOVWF 15h

BSF 05,1 ;Reset 4017NOPBCF 05,1MOVF 11h,0 ;Move file 11 into WMOVWF 06hCALL DelD MOVF 12h,0 ;Move file 12 into WMOVWF 06hCALL DelDMOVF 13h,0 ;Move file 13 into WMOVWF 06hCALL DelDMOVF 14h,0 ;Move file 14 into WMOVWF 06hCALL DelDMOVF 15h,0 ;Move file 15 into WMOVWF 06hCALL DelDRETURN

DelD DECFSZ 1Bh,1GOTO DelDMOVLW 00h ;Zero port B to prevent mirroringMOVWF 06Clk BSF 05,0 ;Clock the 4017NOPBCF 05,0RETURN

Main MOVLW 50h ;Each 10h represents 100mS (10 frames/sec)MOVWF 0ChMain1 CALL Frame1 ;Display frame1 for 1/2 secDECFSZ 0ChGOTO Main1NOPMain2 NOP ;Do-nothing loopGOTO Main2 ; Reset power to view screen again

END

EXPERIMENTO-18ANIMATION-2En este experimento se muestran 5 fotogramas de una animacin Esto le mostrar cmo una animacin o 'cartoon' se crea y cmo se puede ampliar a cualquier nmero de CELLS.Lo primero que debe hacer es dibujar las celdas de la animacin y calcular el valor de cada uno de los LEDs.Estos valores se colocan entonces en el programa.

Para agregar una celda adicional, el nombre cell6 y aadir las 11 lneas de programa para cargar la informacin en las clulas 5 y escanear GOTO.En la rutina principal, poner las 2 lneas de cdigo que determinan la duracin de la pila aparecer en la pantalla , entonces:. Main6 y las 3 lneas de cdigo que crea un bucle para mostrar la celdaLa animacin se puede extender hasta el final de la memoria y si la ltima instruccin es GOTO principal, la animacin se reproduce indefinidamente.En los experimentos posteriores que proporcionan algunas rutinas que usted puede agregar a sus propias animaciones.Experiment-18for "5x7 Display" Project ;PIC16F84 and only F84 chip ;5-cell animation StartORG 0x00BSF 03,5 ;Go to page1 for setting-up the portsMOVLW 00h ;Put 00 into WMOVWF 05h ;to make port 5 (port A) all outputMOVWF 06h ;and make port 6 (port B) all outputBCF 03,5 ;Go to page0 for programmingGOTO Main

Cell1 MOVLW 01h ;place the 5 values into the 5MOVWF 11h ; files to produce the first cellMOVLW 01h ; as shown above.MOVWF 12hMOVLW 01hMOVWF 13hMOVLW 01hMOVWF 14hMOVLW 01hMOVWF 15hGOTO Scan

Cell2 MOVLW 08h ;place the 5 values into the 5MOVWF 11h ; files to produce the second cellMOVLW 04h ; as shown above.MOVWF 12hMOVLW 04hMOVWF 13hMOVLW 02hMOVWF 14hMOVLW 01hMOVWF 15hGOTO Scan

Cell3 MOVLW 40h ;place the 5 values into the 5MOVWF 11h ; files to produce the third cellMOVLW 20h ; as shown above.MOVWF 12hMOVLW 08hMOVWF 13hMOVLW 04hMOVWF 14hMOVLW 01hMOVWF 15hGOTO Scan

Cell4 MOVLW 00h ;place the 5 values into the 5MOVWF 11h ; files to produce the fourth cellMOVLW 00h ; as shown above.MOVWF 12hMOVLW 60hMOVWF 13hMOVLW 1EhMOVWF 14hMOVLW 01hMOVWF 15hGOTO Scan

Cell5 MOVLW 00h ;place the 5 values into the 5MOVWF 11h ; files to produce the fifth cellMOVLW 00h ; as shown above.MOVWF 12hMOVLW 00hMOVWF 13hMOVLW 00hMOVWF 14hMOVLW 7FhMOVWF 15hGOTO Scan

Scan BSF 05,1 ;Reset 4017NOPBCF 05,1MOVF 11h,0 ;Move file 11 into WMOVWF 06hCALL DelDMOVF 12h,0 ;Move file 12 into WMOVWF 06hCALL DelDMOVF 13h,0 ;Move file 13 into WMOVWF 06hCALL DelDMOVF 14h,0 ;Move file 14 into WMOVWF 06hCALL DelDMOVF 15h,0 ;Move file 15 into WMOVWF 06hCALL DelDRETURN

DelD DECFSZ 1Bh,1GOTO DelDMOVLW 00h ;Zero port B to prevent mirroringMOVWF 06Clk BSF 05,0 ;Clock the 4017NOPBCF 05,0RETURN

Main MOVLW 50h ;Each 10h represents 100mSMOVWF 0ChMain1 CALL Cell1 ;Display Cell 1 for 1/2 secDECFSZ 0Ch,1GOTO Main1MOVLW 40h ;Each 10h represents 100mSMOVWF 0ChMain2 CALL Cell2 ;Display Cell 2 for 400mSDECFSZ 0Ch,1GOTO Main2MOVLW 30h ;Each 10h represents 100mSMOVWF 0ChMain3 CALL Cell3 ;Display Cell 3 for 300mSDECFSZ 0Ch,1GOTO Main3MOVLW 20h ;Each 10h represents 100mSMOVWF 0ChMain4 CALL Cell4 ;Display Cell 4 for 200mSDECFSZ 0Ch,1GOTO Main4MOVLW 10h ;Each 10h represents 100mS (10 frames/sec)MOVWF 0ChMain5 CALL Cell5 ;Display Cell 5 for 100mSDECFSZ 0Ch,1GOTO Main5GOTO Main

END

EXPERIMENTO 1-9-ANIMACIN3Este experimento es una sub-rutina.Se inicia con una pantalla totalmente iluminado y las filas se apaga, de abajo a arriba.La rutina se llama WIPE-UP y se pueden incluir en cualquier animacin llamando WipeUp, as: CONVOCATORIA WipeUpAadir WipeUp al programa en el experimento 18.Insertar al final, as:GOTO Main 5 CALL WipeUp GOTO MainExperiment-19for "5x7 Display" Project ;PIC16F84 and only F84 chip ;Sub-routine "WipeUp"WipeUp MOVLW 0FFh MOVWF 11hMOVWF 12hMOVWF 13hMOVWF 14hMOVWF 15hMOVLW 20hMOVWF 0ChXX BCF 11h,0RLF 11h,1BCF 12h,0RLF 12h,1BCF 13h,0RLF 13h,1BCF 14h,0RLF 14h,1BCF 15h,0RLF 15h,1BTFSS 15h,7RETURNYY DECFSZ 0ch,1GOTO ZZGOTO XXZZ CALL ScanGOTO YYScan

END

Experiment-19afor "5x7 Display" Project ;PIC16F84 and only F84 chip ;Experiments 18 & 19 combined:StartORG 0x00BSF 03,5 ;Go to page1 for setting-up the portsMOVLW 00h ;Put 00 into WMOVWF 05h ;to make port 5 (port A) all outputMOVWF 06h ;and make port 6 (port B) all outputBCF 03,5 ;Go to page0 for programmingGOTO Main

Cell1 MOVLW 01h ;place the 5 values into the 5MOVWF 11h ; files to produce the first cellMOVLW 01h ; as shown above.MOVWF 12hMOVLW 01hMOVWF 13hMOVLW 01hMOVWF 14hMOVLW 01hMOVWF 15hGOTO Scan

Cell2 MOVLW 08h ;place the 5 values into the 5MOVWF 11h ; files to produce the second cellMOVLW 04h ; as shown above.MOVWF 12hMOVLW 04hMOVWF 13hMOVLW 02hMOVWF 14hMOVLW 01hMOVWF 15hGOTO Scan

Cell3 MOVLW 40h ;place the 5 values into the 5MOVWF 11h ; files to produce the third cellMOVLW 20h ; as shown above.MOVWF 12hMOVLW 08hMOVWF 13hMOVLW 04hMOVWF 14hMOVLW 01hMOVWF 15hGOTO Scan

Cell4 MOVLW 00h ;place the 5 values into the 5MOVWF 11h ; files to produce the fourth cellMOVLW 00h ; as shown above.MOVWF 12hMOVLW 60hMOVWF 13hMOVLW 1EhMOVWF 14hMOVLW 01hMOVWF 15hGOTO Scan

Cell5 MOVLW 00h ;place the 5 values into the 5MOVWF 11h ; files to produce the fifth cellMOVLW 00h ; as shown above.MOVWF 12hMOVLW 00hMOVWF 13hMOVLW 00hMOVWF 14hMOVLW 7FhMOVWF 15hGOTO Scan

Scan BSF 05,1 ;Reset 4017NOPBCF 05,1MOVF 11h,0 ;Move file 11 into WMOVWF 06h ;Move W to output port6CALL DelDMOVF 12h,0 ;Move file 12 into WMOVWF 06hCALL DelDMOVF 13h,0 ;Move file 13 into WMOVWF 06hCALL DelDMOVF 14h,0 ;Move file 14 into WMOVWF 06hCALL DelDMOVF 15h,0 ;Move file 15 into WMOVWF 06hCALL DelDRETURN

DelD DECFSZ 1Bh,1GOTO DelDMOVLW 00h ;Zero port B to prevent mirroringMOVWF 06Clk BSF 05,0 ;Clock the 4017NOPBCF 05,0RETURNWipeUp MOVLW 0FFh MOVWF 11hMOVWF 12hMOVWF 13hMOVWF 14hMOVWF 15hMOVLW 80h MOVWF 0Ch GOTO YYXX RLF 11h,1 BCF 11h,0 RLF 12h,1 BCF 12h,0 RLF 13h,1 BCF 13h,0 RLF 14h,1 BCF 14h,0 RLF 15h,1 BCF 15h,0BTFSS 15h,7RETURNYY DECFSZ 0Ch,1 GOTO ZZ MOVLW 80h MOVWF 0Ch GOTO XXZZ CALL Scan GOTO YYMain MOVLW 50h ;Each 10h represents 100mSMOVWF 0ChMain1 CALL Cell1 ;Display Cell 1 for 1/2 secDECFSZ 0Ch,1GOTO Main1MOVLW 40h ;Each 10h represents 100mSMOVWF 0ChMain2 CALL Cell2 ;Display Cell 2 for 400mSDECFSZ 0Ch,1GOTO Main2MOVLW 30h ;Each 10h represents 100mSMOVWF 0ChMain3 CALL Cell3 ;Display Cell 3 for 300mSDECFSZ 0Ch,1GOTO Main3MOVLW 20h ;Each 10h represents 100mSMOVWF 0ChMain4 CALL Cell4 ;Display Cell 4 for 200mSDECFSZ 0Ch,1GOTO Main4MOVLW 80h ;Each 10h represents 100mSMOVWF 0ChMain5 CALL Cell5 ;Display Cell 5 for 800mSDECFSZ 0Ch,1GOTO Main5CALL WipeUpGOTO Main

END GOTO principal 5EXPERIMENTO-20ANIMATION-4Este experimento cubra otro sub-rutina llamada WIPE-DOWN.Es muy similar a WipeUp, excepto el efecto es el inverso.La pantalla completamente iluminada, poco a poco se apaga desde la fila superior a la fila inferior.En el siguiente programa, lo hemos combinado con experimentos 18 y 19 para obtener la animacin de 5 celdas (fan-efecto a partir de la esquina superior derecha), y luego WipeUp, entonces WipeDown.Puede ser nuestros programas son muy largos, pero hay que recordar que estn "hablando directamente al microcontrolador" con cada una de las instrucciones y cada instruccin slo puede pedir una cosa por hacer.Si se introduce una mayor lenguaje de alto nivel tal como BASIC o C o cualquier otro lenguaje que requiere una sola lnea para realizar una instruccin compleja, la lengua tiene un conjunto de instrucciones (como el nuestro) escondidos en una rutina, a fin de que la operacin se puede realizar.si que desea realizar operaciones a travs de una sola lnea de cdigo que puede obtener un conjunto completo de las rutinas de nuestrabiblioteca de rutinascaptulo.Hemos creado sub-rutinas para una lnea alterna, produce un pulso, etc, etc, y estos se han reunido en un captulo enorme llamada Biblioteca de rutinas.Una vez finalizado el proyecto que usted ser capaz de avanzar a la siguiente fase de la programacin, y estas subrutinas ser muy til.Experiment-20for "5x7 Display" Project ;PIC16F84 and only F84 chip ;5-cell animation with WipeUp and WipeDown.Start ORG 0x00BSF 03,5 ;Go to page1 for setting-up the portsMOVLW 00h ;Put 00 into WMOVWF 05h ;to make port 5 (port A) all outputMOVWF 06h ;and make port 6 (port B) all outputBCF 03,5 ;Go to page0 for programmingGOTO Main

Cell1 MOVLW 01h ;place the 5 values into the 5MOVWF 11h ; files to produce the first cellMOVLW 01h ; as shown above.MOVWF 12hMOVLW 01hMOVWF 13hMOVLW 01hMOVWF 14hMOVLW 01hMOVWF 15hGOTO Scan

Cell2 MOVLW 08h ;place the 5 values into the 5MOVWF 11h ; files to produce the second cellMOVLW 04h ; as shown above.MOVWF 12hMOVLW 04hMOVWF 13hMOVLW 02hMOVWF 14hMOVLW 01hMOVWF 15hGOTO Scan

Cell3 MOVLW 40h ;place the 5 values into the 5MOVWF 11h ; files to produce the third cellMOVLW 20h ; as shown above.MOVWF 12hMOVLW 08hMOVWF 13hMOVLW 04hMOVWF 14hMOVLW 01hMOVWF 15hGOTO Scan

Cell4 MOVLW 00h ;place the 5 values into the 5MOVWF 11h ; files to produce the fourth cellMOVLW 00h ; as shown above.MOVWF 12hMOVLW 60hMOVWF 13hMOVLW 1EhMOVWF 14hMOVLW 01hMOVWF 15hGOTO Scan

Cell5 MOVLW 00h ;place the 5 values into the 5MOVWF 11h ; files to produce the fifth cellMOVLW 00h ; as shown above.MOVWF 12hMOVLW 00hMOVWF 13hMOVLW 00hMOVWF 14hMOVLW 7FhMOVWF 15hGOTO Scan

Scan BSF 05,1 ;Reset 4017NOPBCF 05,1MOVF 11h,0 ;Move file 11 into WMOVWF 06hCALL DelDMOVF 12h,0 ;Move file 12 into WMOVWF 06hCALL DelDMOVF 13h,0 ;Move file 13 into WMOVWF 06hCALL DelDMOVF 14h,0 ;Move file 14 into WMOVWF 06hCALL DelDMOVF 15h,0 ;Move file 15 into WMOVWF 06hCALL DelDRETURN

DelD DECFSZ 1Bh,1GOTO DelDMOVLW 00h ;Zero port B to prevent mirroringMOVWF 06Clk BSF 05,0 ;Clock the 4017NOPBCF 05,0RETURN

WipeUp MOVLW 0FFh MOVWF 11h MOVWF 12h MOVWF 13h MOVWF 14h MOVWF 15h MOVLW 80h MOVWF 0Ch GOTO YYXX RLF 11h,1 BCF 11h,0 RLF 12h,1 BCF 12h,0 RLF 13h,1 BCF 13h,0 RLF 14h,1 BCF 14h,0 RLF 15h,1 BCF 15h,0 BTFSS 15h,7 RETURNYY DECFSZ 0Ch,1 GOTO ZZ MOVLW 80h MOVWF 0Ch GOTO XXZZ CALL Scan GOTO YY

WDown MOVLW 0FFh MOVWF 11h MOVWF 12h MOVWF 13h MOVWF 14h MOVWF 15h MOVLW 80h MOVWF 0Ch GOTO BBAA RRF 11h,1 BCF 11h,7 RRF 12h,1 BCF 12h,7 RRF 13h,1 BCF 13h,7 RRF 14h,1 BCF 14h,7 RRF 15h,1 BCF 15h,7BB DECFSZ 0Ch,1 GOTO CC MOVLW 80h MOVWF 0Ch BTFSS 15h,0 RETURN GOTO AACC CALL ScanGOTO BB

Main MOVLW 0F0h ;Each 10h represents 100mS MOVWF 0ChMain1 CALL Cell1 ;Display Cell 1 for 1/2 sec DECFSZ 0Ch,1 GOTO Main1

MOVLW 40h ;Each 10h represents 100mS MOVWF 0ChMain2 CALL Cell2 ;Display Cell 2 for 400mS DECFSZ 0Ch,1 GOTO Main2

MOVLW 30h ;Each 10h represents 100mS MOVWF 0ChMain3 CALL Cell3 ;Display Cell 3 for 300mS DECFSZ 0Ch,1 GOTO Main3

MOVLW 20h ;Each 10h represents 100mS MOVWF 0ChMain4 CALL Cell4 ;Display Cell 4 for 200mS DECFSZ 0Ch,1 GOTO Main4

MOVLW 80h ;Each 10h represents 100mS MOVWF 0ChMain5 CALL Cell5 ;Display Cell 5 for 800mS DECFSZ 0Ch,1 GOTO Main5 CALL WipeUp CALL WDown GOTO Main

END

EXPERIMENTO-21-5 ANIMACINEste es otro sub-rutina que se pueden incorporar en sus propias rutinas.Se llama SLASH.La sub-rutina pone una diagonal de la pantalla como se muestra en el siguiente diagrama.Lleva 11 cuadros para la diagonal para pasar de la parte inferior izquierda esquina de la parte superior derecha de la esquina.Cuando esta rutina se incorpora en una de sus propias rutinas, ya tendrs Escanear subrutina en el programa.Para ejecutar "Slash", agrega elTajosub-rutina yShiftUpsub-rutina y aadirLLAMADA raya verticalen la rutina principal.

La velocidad de la rutina se determina por el valor cargado en archivo 0C.En nuestro caso el valor es 20h.Para una accin ms rpida, reducir este valor.A 80h, la animacin es cuatro veces ms lento que el programa siguiente.As es como funciona el programa:Los primeros 7 Instrucciones de configurar los puertos como salidas.Port A (puerto 05) y restablece los relojes el 4017 registro de desplazamiento.Los primeros 5 salidas del 4017 estn conectados a los transistores y los sumideros de estos los ctodos de cada columna de LEDs.7 Las filas de LEDs estn conectados al puerto B (puerto 6) a travs de pequeas resistencias de limitacin de corriente y la salida 8 de este puerto est conectado a un diafragma piezoelctrico.La instruccin 8 en el programa enva al procesador principal, donde se crea un bucle para el "Slash" sub-rutina.Al Raya vertical sub-rutina de la primera instruccin borra el bit de acarreo (el indicador de acarreo).Esto es para evitar los correos en el bit de acarreo que aparece en la pantalla cuando una operacin de desplazamiento se ejecuta.Los cinco archivos se cargan con el cero y el primer bit en el archivo 11 est situado de modo que la parte inferior izquierda esquina se iluminar.El programa luego llama a un ShiftUp sub-rutina llamada que en primer lugar llama Scan sub-rutina de un nmero de veces (el valor cargado en el archivo 0C), la rotacin de cada uno de los archivos de "izquierda".Esto mueve de manera efectiva los LEDs iluminados hasta la pantalla.El LED inferior de la columna siguiente se activa y ejecuta la visualizacin de sub-rutina.De esta manera, los LEDs se levantan la pantalla.Cuando un LED alcanza la parte superior, debe ser apagado (BCF) de modo que no aparece en la parte inferior de la pantalla (a travs de la operacin de rotacin).Esto se hace mediante las 4 instrucciones FBC.shiftUp La subrutina llama a la exploracin sub-rutina y esto lleva a cabo dos operaciones.En primer lugar se pone a cero el registro de desplazamiento 4017 (en realidad un chip contador, sino que se utiliza como un dispositivo de cambio) y luego mueve el valor en cada archivo al puerto de salida (puerto 6) y llama a una rutina de retardo para que los LEDs apropiados se ver.La rutina de sub-entonces sincroniza el 4017 de modo que el transistor hundimiento siguiente ser activado y cuando el valor en el archivo siguiente se pasa al puerto de salida, la segunda fila de LEDs se activan.Esto contina para las columnas 5 y los retornos a la micro ShiftUp sub-rutina para repetir la secuencia de modo que toda la pantalla es para ser encendido al mismo tiempo.Despus de 20 hex pasa de la rutina de exploracin de los micro espiras en el bit ms bajo siguiente en una columna y se repite la secuencia.Experiment-21for "5x7 Display" Project ;PIC16F84 and only F84 chip ;SLASH animation StartORG 0x00BSF 03,5 ;Go to page1 for setting-up the portsMOVLW 00h ;Put 00 into WMOVWF 05h ;to make port 5 (port A) all outputMOVWF 06h ;and make port 6 (port B) all outputBCF 03,5 ;Go to page0 for programmingGOTO Main

Slash BCF 03h,0 ;Clear the carry bitMOVLW 00hMOVWF 11hMOVWF 12hMOVWF 13hMOVWF 14hMOVWF 15hBSF 11h,0CALL ShiftUpBSF 12h,0CALL ShiftUpBSF 13h,0CALL ShiftUpBSF 14h,0CALL ShiftUpBSF 15h,0CALL ShiftUpCALL ShiftUpCALL ShiftUpBCF 11h,7CALL ShiftUpBCF 12h,7CALL ShiftUpBCF 13h,7CALL ShiftUpBCF 14h,7CALL ShiftUpRETURN

ShiftUp MOVLW 20h MOVWF 0ChShift1 DECFSZ 0Ch,1 GOTO Shift2 RLF 11h,1 RLF 12h,1 RLF 13h,1 RLF 14h,1 RLF 15h,1 RETURNShift2 CALL Scan GOTO Shift1

Scan BSF 05,1 ;Reset 4017NOPBCF 05,1MOVF 11h,0 ;Move file 11 into WMOVWF 06hCALL DelDMOVF 12h,0 ;Move file 12 into WMOVWF 06hCALL DelDMOVF 13h,0 ;Move file 13 into WMOVWF 06hCALL DelDMOVF 14h,0 ;Move file 14 into WMOVWF 06hCALL DelDMOVF 15h,0 ;Move file 15 into WMOVWF 06hCALL DelDRETURN

DelD DECFSZ 1Bh,1GOTO DelDMOVLW 00h ;Zero port B to prevent mirroringMOVWF 06Clk BSF 05,0 ;Clock the 4017NOPBCF 05,0RETURNMain CALL Slash ;Display SlashGOTO Main

END

EXPERIMENTO-22ANIMATION-6He aqu una animacin de 5 celda que utiliza subrutinas del experimento 18.Se llama SPLASH.

Lo primero que tienes que hacer es averiguar cmo se va a escribir el programa.Observa la secuencia de las clulas y ver si un patrn se presenta cuando los LEDs se pueden "girar" la instruccin.Si esto no es posible, usted tendr que calcular el valor hexadecimal de cada LED y usar nuestro programa de animacin del experimento 18.Pruebe este programa es muy eficazExperiment-22for "5x7 Display" Project ;PIC16F84 and only F84 chip ;SPLASHStartORG 0x00BSF 03,5 ;Go to page1 for setting-up the portsMOVLW 00h ;Put 00 into WMOVWF 05h ;to make port 5 (port A) all outputMOVWF 06h ;and make port 6 (port B) all outputBCF 03,5 ;Go to page0 for programmingGOTO Main

Cell1 MOVLW 00h ;place the 5 values into the 5MOVWF 11h ; files to produce the first cellMOVLW 00h ; as shown above.MOVWF 12hMOVLW 08hMOVWF 13hMOVLW 00hMOVWF 14hMOVLW 00hMOVWF 15hGOTO Scan

Cell2 MOVLW 00h ;place the 5 values into the 5MOVWF 11h ; files to produce the second cellMOVLW 1Ch ; as shown above.MOVWF 12hMOVLW 14hMOVWF 13hMOVLW 1ChMOVWF 14hMOVLW 00hMOVWF 15hGOTO Scan

Cell3 MOVLW 3Eh ;place the 5 values into the 5MOVWF 11h ; files to produce the third cellMOVLW 22h ; as shown above.MOVWF 12hMOVLW 22hMOVWF 13hMOVLW 22hMOVWF 14hMOVLW 3EhMOVWF 15hGOTO Scan

Cell4 MOVLW 41h ;place the 5 values into the 5MOVWF 11h ; files to produce the fourth cellMOVLW 41h ; as shown above.MOVWF 12hMOVLW 41hMOVWF 13hMOVLW 41hMOVWF 14hMOVLW 41hMOVWF 15hGOTO Scan

Cell5 MOVLW 00hMOVWF 11h ;The fifth cell is blankMOVLW 00hMOVWF 12hMOVLW 00hMOVWF 13hMOVLW 00hMOVWF 14hMOVLW 00hMOVWF 15hGOTO Scan

Scan BSF 05,1 ;Reset 4017NOPBCF 05,1MOVF 11h,0 ;Move file 11 into WMOVWF 06hCALL DelDMOVF 12h,0 ;Move file 12 into WMOVWF 06hCALL DelDMOVF 13h,0 ;Move file 13 into WMOVWF 06hCALL DelDMOVF 14h,0 ;Move file 14 into WMOVWF 06hCALL DelDMOVF 15h,0 ;Move file 15 into WMOVWF 06hCALL DelDRETURN

DelD DECFSZ 1Bh,1GOTO DelDMOVLW 00h ;Zero port B to prevent mirroringMOVWF 06Clk BSF 05,0 ;Clock the 4017NOPBCF 05,0RETURN

Main MOVLW 50h ;Each 10h represents 100mSMOVWF 0ChMain1 CALL Cell1 ;Display Cell 1 for 1/2 secDECFSZ 0ChGOTO Main1

MOVLW 10h ;Each 10h represents 100mSMOVWF 0ChMain2 CALL Cell2 ;Display Cell 2 for 100mSDECFSZ 0ChGOTO Main2

MOVLW 10h ;Each 10h represents 100mSMOVWF 0ChMain3 CALL Cell3 ;Display Cell 3 for 100mSDECFSZ 0ChGOTO Main3

MOVLW 10h ;Each 10h represents 100mSMOVWF 0ChMain4 CALL Cell4 ;Display Cell 4 for 100mSDECFSZ 0ChGOTO Main4

MOVLW 80h ;Each 10h represents 100mSMOVWF 0ChMain5 CALL Cell5 ;Display Cell 5 for 800mSDECFSZ 0ChGOTO Main5GOTO Main

ENDExperimentosPgina 9

EXPERIMENTO-23Este experimento muestra cmo mostrar una caracterstica (por ejemplo, una animacin) Despus de un botn se ha presionado.Presione el botn "A" y SPLASH mostrar una vez:Para probar la funcin de rebote, presione y suelte el botn muy lentamente .Tenga en cuenta que la animacin slo aparece una vez.Esto es debido a que el botn debe ser liberado para los bucles 40h antes de que se reconoce de nuevo.Trate de bucles 20 horas (o menos) y la animacin se producirdos vecesen algunas ocasiones.Esto demuestra lo rpido que el micro se est ejecutando el programa - que est realizando bucles 20h del programa en el momento en que se suelta el botn y las selecciones micro hasta los "pulsos" de rebote al final del botn de liberacin para mostrar SPLASH el segundo tiempo.Experiment-23for "5x7 Display" Project ;PIC16F84 and only F84 chip ;Press button A for SPLASH!- with debounce

Start ORG 0x00BSF 03,5 ;Go to page1 for setting-up the portsMOVLW 04h ;Put 04 into WMOVWF 05h ; to make RA2 inputMOVLW 00h ;Put 00 into WMOVWF 06h ;and make port 6 (port B) all outputBCF 03,5 ;Go to page0 for programmingGOTO Main

Cell1 MOVLW 00h ;place the 5 values into the 5MOVWF 11h ; files to produce the first cellMOVLW 00h ; as shown above.MOVWF 12hMOVLW 08hMOVWF 13hMOVLW 00hMOVWF 14hMOVLW 00hMOVWF 15hGOTO Scan

Cell2 MOVLW 00h ;place the 5 values into the 5MOVWF 11h ; files to produce the second cellMOVLW 1Ch ; as shown above.MOVWF 12hMOVLW 14hMOVWF 13hMOVLW 1ChMOVWF 14hMOVLW 00hMOVWF 15hGOTO Scan

Cell3 MOVLW 3Eh ;place the 5 values into the 5MOVWF 11h ; files to produce the third cellMOVLW 22h ; as shown above.MOVWF 12hMOVLW 22hMOVWF 13hMOVLW 22hMOVWF 14hMOVLW 3EhMOVWF 15hGOTO Scan

Cell4 MOVLW 41h ;place the 5 values into the 5MOVWF 11h ; files to produce the fourth cellMOVLW 41h ; as shown above.MOVWF 12hMOVLW 41hMOVWF 13hMOVLW 41hMOVWF 14hMOVWF 15hGOTO Scan

Cell5 MOVLW 00h ;place the 5 values into the 5MOVWF 11h ; files to produce the fifth cellMOVLW 00h ; as shown above.MOVWF 12hMOVLW 00hMOVWF 13hMOVLW 00hMOVWF 14hMOVLW 00hMOVWF 15hGOTO Scan

Scan BSF 05,1 ;Reset 4017NOPBCF 05,1MOVF 11h,0 ;Move file 11 into WMOVWF 06hCALL DelDMOVF 12h,0 ;Move file 12 into WMOVWF 06hCALL DelDMOVF 13h,0 ;Move file 13 into WMOVWF 06hCALL DelDMOVF 14h,0 ;Move file 14 into WMOVWF 06hCALL DelDMOVF 15h,0 ;Move file 15 into WMOVWF 06hCALL DelDRETURN

DelD DECFSZ 1Bh,1GOTO DelDMOVLW 00h ;Zero port B to prevent mirroringMOVWF 06Clk BSF 05,0 ;Clock the 4017NOPBCF 05,0RETURN

Splash MOVLW 50h ;Each 10h represents 100mS MOVWF 0ChSplash1 CALL Cell1 ;Display Cell 1 for 1/2 sec DECFSZ 0Ch GOTO Splash1 MOVLW 10h ;Each 10h represents 100mS MOVWF 0ChSplash2 CALL Cell2 ;Display Cell 2 for 100mS DECFSZ 0Ch GOTO Splash2 MOVLW 10h ;Each 10h represents 100mS MOVWF 0ChSplash3 CALL Cell3 ;Display Cell 3 for 100mS DECFSZ 0Ch GOTO Splash3 MOVLW 10h ;Each 10h represents 100mS MOVWF 0ChSplash4 CALL Cell4 ;Display Cell 4 for 100mS DECFSZ 0Ch GOTO Splash4 MOVLW 08h ;Each 10h represents 100mS MOVWF 0ChSplash5 CALL Cell5 ;Display Cell 5 for 50mS DECFSZ 0Ch GOTO Splash5 RETURN

Main MOVLW 40hMOVWF 1DhMain1 BTFSC 05,2 ;Test for button A. NOT pressed line = LOWGOTO Main2 ;PressedMOVF 1Dh,0 ;Not pressedXORLW 00BTFSC 03,2 ;Is file 1D = 0?GOTO Main1 ;YesDECF 1Dh,1 ;No. Decrement Debounce fileGOTO Main1Main2 MOVF 1Dh,0 ;Move file 1D to WXORLW 00BTFSS 03,2 ;Is file 1D = 0? Is the zero-flag SET?GOTO Main1 ;NoCALL Splash ;YesGOTO Main

END

EXPERIMENTO-24Esta es una extensin del experimento 23.Presione el botn A para iniciar y detener la animacin SPLASH.Botn A se convierte en un botn de activacin - con START / STOP caracterstica.Es importante etiquetar las banderas para que usted sepa exactamente lo que estn indicando.Las dos banderas en este experimento detectar lo mismo (pulsacin de botn), pero su posicin en el programa permite detectar diferentes caractersticas.Flag 1E, 5 s enviar el micro a la rutina de inicio mientras 1E, 4 detecta cuando el botn no est presionado para que el programa pueda determinar cuando una accin de palanca que ha ocurrido con el botn.Creacin de una funcin de conmutacin toma una gran cantidad de pensamiento que las instrucciones deben ser colocados en los lugares indicados en el programa para lograr el resultado deseado.Experiment-24for "5x7 Display" Project ;PIC16F84 and only F84 chip;Press button A to START/STOP Splash animation

Start ORG 0x00BSF 03,5 ;Go to page1 to set-up the portsMOVLW 04h ;Put 04 into WMOVWF 05h ; to make RA2 inputMOVLW 00h ;Put 00 into WMOVWF 06h ;and make port 6 (port B) all outputBCF 03,5 ;Go to page0 for programmingGOTO Main

Cell1 MOVLW 00h ;place the 5 values into the 5MOVWF 11h ; files to produce the first cellMOVLW 00h ; as shown above.MOVWF 12hMOVLW 08hMOVWF 13hMOVLW 00hMOVWF 14hMOVLW 00hMOVWF 15hGOTO Scan

Cell2 MOVLW 00h ;place the 5 values into the 5MOVWF 11h ; files to produce the second cellMOVLW 1Ch ; as shown above.MOVWF 12hMOVLW 14hMOVWF 13hMOVLW 1ChMOVWF 14hMOVLW 00hMOVWF 15hGOTO Scan

Cell3 MOVLW 3Eh ;place the 5 values into the 5MOVWF 11h ; files to produce the third cellMOVLW 22h ; as shown above.MOVWF 12hMOVLW 22hMOVWF 13hMOVLW 22hMOVWF 14hMOVLW 3EhMOVWF 15hGOTO Scan

Cell4 MOVLW 41h ;place the 5 values into the 5MOVWF 11h ; files to produce the fourth cellMOVLW 41h ; as shown above.MOVWF 12hMOVLW 41hMOVWF 13hMOVLW 41hMOVWF 14hMOVLW 41hMOVWF 15hGOTO Scan

Cell5 MOVLW 00h ;place the 5 values into the 5MOVWF 11h ; files to produce the fifth cellMOVLW 00h ; as shown above.MOVWF 12hMOVLW 00hMOVWF 13hMOVLW 00hMOVWF 14hMOVLW 00hMOVWF 15hGOTO Scan

Scan BSF 05,1 ;Reset 4017NOPBCF 05,1MOVF 11h,0 ;Move file 11 into WMOVWF 06hCALL DelDMOVF 12h,0 ;Move file 12 into WMOVWF 06hCALL DelDMOVF 13h,0 ;Move file 13 into WMOVWF 06hCALL DelDMOVF 14h,0 ;Move file 14 into WMOVWF 06hCALL DelDMOVF 15h,0 ;Move file 15 into WMOVWF 06hCALL DelDRETURN

DelD BTFSC 05,2 ;A pushed? Pushed = HIGHGOTO Del1BCF 1E,4 ;Clear the button-pushed flagGOTO Del2Del1 BSF 1E,4 ;Set the button-pushed flagDel2 DECFSZ 1Bh,1GOTO Del2MOVLW 00h ;Zero port B to prevent mirroringMOVWF 06Clk BSF 05,0 ;Clock the 4017NOPBCF 05,0BTFSS 05,2 ;A pushed?RETURN ;A not pushedBTFSC 1E,4 ;Has the button been released?RETURN ;No.BCF 1E,5 ;Yes. Don't send Micro to SPLASHRETURN

Splash MOVLW 50h ;Each 10h represents 100mS MOVWF 0ChSplash1 CALL Cell1 ;Display Cell 1 for 1/2 sec DECFSZ 0Ch GOTO Splash1

MOVLW 10h ;Each 10h represents 100mS MOVWF 0ChSplash2 CALL Cell2 ;Display Cell 2 for 100mS DECFSZ 0Ch GOTO Splash2

MOVLW 10h ;Each 10h represents 100mS MOVWF 0ChSplash3 CALL Cell3 ;Display Cell 3 for 100mS DECFSZ 0Ch GOTO Splash3

MOVLW 10h ;Each 10h represents 100mS MOVWF 0ChSplash4 CALL Cell4 ;Display Cell 4 for 100mS DECFSZ 0Ch GOTO Splash4

MOVLW 08h ;Each 10h represents 100mS MOVWF 0ChSplash5 CALL Cell5 ;Display Cell 5 for 50mS DECFSZ 0Ch GOTO Splash5 RETURN

Main BCF 1E,5 ;This flag sends micro to SPLASHBCF 1E,4 ;This flag detects button NOT pressedMain1 BTFSS 05,2 ;Is button A pushed? Pushed = HIGHGOTO Main2 ;Not pressedBSF 1E,5 ;Pressed. Set 1E,5 flagCALL SplashGOTO Main1Main2 BTFSS 1E,5GOTO Main1CALL SplashGOTO Main1

END