0% found this document useful (0 votes)
40 views26 pages

For "5x7 Display" Project: Experiment-8

This document contains code for several experiments using a PIC16F84 microcontroller to control a 5x7 LED display. Experiment 8 moves a column of LEDs across and back the display. Experiment 9 moves a column across/back and then up and down. Experiment 11 implements an elevator display that shows floor numbers. Experiment 13 implements a 0-9 up counter display. The code includes routines for initializing ports, driving the LED display, and implementing delays. Tables of data are used to represent the numeric digits on the display.

Uploaded by

yosoy555
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views26 pages

For "5x7 Display" Project: Experiment-8

This document contains code for several experiments using a PIC16F84 microcontroller to control a 5x7 LED display. Experiment 8 moves a column of LEDs across and back the display. Experiment 9 moves a column across/back and then up and down. Experiment 11 implements an elevator display that shows floor numbers. Experiment 13 implements a 0-9 up counter display. The code includes routines for initializing ports, driving the LED display, and implementing delays. Tables of data are used to represent the numeric digits on the display.

Uploaded by

yosoy555
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 26

Experiment-8 for "5x7 Display" Project

;PIC16F84 and only F84 chip


;Column of LEDs moves across and back
Start ORG 0x00
BSF 03,5
MOVLW 00h
MOVWF 05h
MOVWF 06h
BCF 03,5
Shift

MOVLW 05
MOVWF 19h
BSF 05h,1
BCF 05h,1

Shift1 MOVLW 7F
MOVWF 06h
CALL Delay
MOVLW 00
MOVWF 06h
CALL Clock
DECFSZ 19h,1
GOTO Shift1
MOVLW 03h
MOVWF 19h
AAA CALL Back
DECFSZ 19h,1
GOTO AAA
GOTO Shift

Back BSF 05h,1


BCF 05h,1
MOVLW 00h
MOVWF 06h
MOVF 19h,0
MOVWF 18h
BBB CALL Clock
DECFSZ 18h,1
GOTO BBB
MOVLW 7Fh
MOVWF 06h
CALL Delay
RETURN
Clock BCF 05,0
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
END

;Go to page1 for setting-up the ports


;Put 00 into W
;Make all RA lines output
;Make all RB lines output
;Go to Page0 for programming

;Put 5 in the Count file for 5 columns


;Reset 4017
;allow 4017 to clock via clock line

;Turn on 7 outputs for LEDs


;Turn off LEDs to prevent mirroring
;Clock the 4017
;Decrement the count file

;3 shifts - yes 3 shifts!

;Reset 4017 and allow 4017 to clock


;Turn off LEDs to prevent "streaking"
;Copy 19h into W
;Copy W into file 18h

;Turn on all 7 LEDs

;Clock the 4017

Experiment-9 for "5x7 Display" Project


;PIC16F84 and only F84 chip
;Column of LEDs moves across/back then up and down
Start ORG 0x00
BSF 03,5
MOVLW 00h
MOVWF 05h
MOVWF 06h
BCF 03,5
GOTO Main
BSF 05h,1
BCF 05h,1
MOVLW 00h
MOVWF 06h
MOVF 19h,0
MOVWF 18h
Back1 CALL Clock
DECFSZ 18h,1
GOTO Back1
MOVLW 7Fh
MOVWF 06h
CALL Delay
RETURN

;Go to page1 for setting-up the ports


;Put 00 into W
;Make all RA lines output
;Make all RB lines output
;Go to Page0 for programming

Back

Scan

MOVLW 080h
MOVWF 1Ch
Scan1 BSF 05h,1
BCF 05h,1
MOVLW 05h
MOVWF 19h
Scan2 CALL Short
BCF 05,0
BSF 05,0
DECFSZ 19h,1
GOTO Scan2
DECFSZ 1Ch,1
GOTO Scan1
RETURN

Clock BCF 05,0


NOP
BSF 05,0
RETURN

;Reset 4017 and allow 4017 to clock


;Turn off LEDs to prevent "streaking"
;Copy 19h into W
;Copy W into file 18h

;Turn on all 7 LEDs

;Determines the number of scans before


; incrementing routine
;Reset 4017
;allow 4017 to clock via clock line
;File 19h counts the number of columns

;Clock the 4017

;Clock the 4017

Delay MOVLW 03
MOVWF 1Ah
Delay1 DECFSZ 1Bh,1
GOTO Delay1
DECFSZ 1Ch,1
GOTO Delay1
DECFSZ 1Ah,1
GOTO Delay1
RETURN
;Short Delay
Short DECFSZ 1Bh,1
GOTO Short
RETURN
;Moves a column of LEDs across the screen and back,
;then up and down the screen
Main

MOVLW 05
MOVWF 19h
BSF 05h,1
BCF 05h,1
Main1 MOVLW 7F
MOVWF 06h
CALL Delay
MOVLW 00
MOVWF 06h

;Put 5 in the Count file for 5 columns


;Reset 4017
;allow 4017 to clock via clock line
;Turn on 7 outputs for LEDs
;Turn off LEDs to prevent mirroring

CALL Clock
DECFSZ 19h,1
GOTO Main1
MOVLW 03h
MOVWF 19h
Main2 CALL Back
DECFSZ 19h,1
GOTO Main2
BSF 05h,1
BCF 05h,1
CALL Delay
MOVLW 01
MOVWF 06h
BCF 03h,0
Main3 CALL Scan
RLF 06,1
BTFSS 06,7
GOTO Main3
MOVLW 20h
MOVWF 06h
Main4 CALL Scan
RRF 06,1
BTFSS 06,0
GOTO Main4
CALL Scan
GOTO Main

;Clock the 4017


;Decrement the count file

;3 shifts - yes 3 shifts!

;Reset 4017
;This illuminates the first row!
;Turn on first LED
;clear the carry flag

;When 8th! output is HIGH, program repeats

;This illuminates bottom row!

END

Experiment-11 for "5x7 Display" Project


; ELEVATOR DISPLAY
Start

Table1

ORG 0x00
BSF 03,5
MOVLW 0Ch
MOVWF 05h
MOVLW 00h
MOVWF 06h
BCF 03,5
GOTO Main

;Go to page1 for setting-up the ports


;Put 0C into W
; to make RA2 & RA3 input
;Put 00 into W
;to make all RB lines output
;Go to Page0 for programming

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

;PIC16F84 and only F84 chip

RETLW 10h
RETLW 1Eh
RETLW 01h
RETLW 11h
RETLW 0Eh
RETLW 00h
RETLW 02h
RETLW 06h
RETLW 0Ah
RETLW 12h
RETLW 1Fh
RETLW 02h
RETLW 02h
RETLW 00h
RETLW 0Eh
RETLW 11h
RETLW 01h
RETLW 06h
RETLW 01h
RETLW 11h
RETLW 0Eh
RETLW 00h
RETLW 0Eh
RETLW 11h
RETLW 01h
RETLW 0Eh
RETLW 10h
RETLW 10h
RETLW 1Fh
RETLW 00h
RETLW 04h
RETLW 0Ch
RETLW 14h
RETLW 04h
RETLW 04h
RETLW 04h
RETLW 04h
RETLW 00h
RETLW 0Eh
RETLW 11h
RETLW 10h
RETLW 17h
RETLW 11h
RETLW 11h
RETLW 00h
RETLW 00h

;4

;3

;2

;1

;G

;Ghost routine transfers data from the


; Ghost files to the Video Screen
; and scans the Video Screen ONCE
Ghost

DelA

BSF 05,1
NOP
BCF 05,1
MOVF 11h,0
MOVWF 06h
CALL DelA
MOVF 12h,0
MOVWF 06h
CALL DelA
MOVF 13h,0
MOVWF 06h
CALL DelA
MOVF 14h,0
MOVWF 06h
CALL DelA
MOVF 15h,0
MOVWF 06h
CALL DelA
RETURN

;Reset 4017

;Move the data from the


; Ghost files to
; the output port
; and call a Delay so the
; LED can be illuminated

DECFSZ 1Bh,1
GOTO DelA
MOVLW 00h
MOVWF 06

Clk

BCF 05,0
NOP
BSF 05,0
RETURN

;Clock the 4017 to the


; next output

;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

FilBott

RRF 11h,1
RRF 12h,1
RRF 13h,1
RRF 14h,1
RRf 15h,1
BCF 11h,6
BCF 12h,6
BCF 13h,6
BCF 14h,6
BCF 15h,6
BTFSS 16h,4
GOTO L
BSF 11h,6
BTFSS 16h,3
GOTO M
BSF 12h,6
BTFSS 16h,2
GOTO N
BSF 13h,6
BTFSS 16h,1
GOTO O
BSF 14h,6
BTFSS 16h,0
RETURN
BSF 15h,6
RETURN

;Move each bit down the file


; to make room at the top

;Clear bit 6 in each file = 7th row of LEDs


; on the Video Screen.

;See if bit4 (the 5th bit) is 0 or 1


;If it's 0, go to the next test
;If it's 1, set bit 6 of the Ghost file

;File 16h was generated by adding thr value of


; of each pixel in the row of each number
; see Table1 and diagram 1 for details.

RLF 11h,1 ;Same principle as above, but this time


RLF 12h,1 ; the bits in the file are moved up to
RLF 13h,1 ; leave a gap at the bottom.
RLF 14h,1
RLF 15h,1
BCF 11h,0 ;Clear the lowest bit of each Ghost file
BCF 12h,0
BCF 13h,0
BCF 14h,0
BCF 15h,0
BTFSS 16h,4
GOTO P
BSF 11h,0
BTFSS 16h,3
GOTO Q
BSF 12h,0
BTFSS 16h,2
GOTO R
BSF 13h,0
BTFSS 16h,1
GOTO S
BSF 14h,0
BTFSS 16h,0
RETURN
BSF 15h,0
RETURN

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


;from Table1

FilGho

MOVLW 08
MOVWF 1A ;1A is count file for 7 cycles of "FilGho"
MOVLW 58h
MOVWF 19h ;File19h is button B pointer for Table1
MOVLW 50h ;Jump down table1 50h locations
MOVWF 17h ;file17h is button A pointer for Table1

FilGho1 CALL Table1


MOVWF 16h
CALL FillTop
DECF 17h,1
;File 17h is the table pointer for button A
DECF 19h,1
;File 19h is the table pointer for button B
MOVF 17h,0 ;Put pointer into W
DECFSZ 1A,1
GOTO FilGho1
RETURN

;MAIN ROUTINE
Main

CALL FilGho
CALL Ghost
BTFSC 05h,2
GOTO Main2
GOTO Main

Main2

MOVLW 08
MOVWF 1A
MOVLW 20h
MOVWF 18h

Main3

Main4

Main5

MainA

MainB

Main6
Main7

Main8

;Put "G" on screen


;Display whatever is in Ghost files
;Test for button A
;Pushed

;File 18h holds number of scans before adding next


row

CALL Ghost
DECFSZ 18h,1
GOTO Main4
MOVF 17h,0
;Put table1 pointer into W
CALL Table1
MOVWF 16h
CALL FillTop
DECF 17h,1
DECF 19h,1
;19h is pointer for button B
DECFSZ 1A,1
GOTO Main3
CALL Ghost
;Display whatever is in Ghost files
BTFSC 05h,2
;Test for button A
GOTO MainA
;Button A Pushed
BTFSC 05h,3
;Test for Button B
GOTO MainB
;Button B pushed
GOTO Main5
MOVF 17h,0
XORLW 00h
BTFSC 03,2
GOTO Main5
GOTO Main2
MOVF 19h,0
XORLW 50h
BTFSC 03,2
GOTO Main5
MOVLW 08
MOVWF 1Ah
MOVLW 20h
MOVWF 18h

;Copy 17h into W


;Button A not to work. On floor 9!

;Copy 19h into W


;Button B not to work. On G floor!

;File 18h holds the number of scans before


adding next row

CALL Ghost
DECFSZ 18h,1
GOTO Main8
MOVF 19h,0
;Put table1 pointer into W
CALL Table1
MOVWF 16h
CALL FilBott
INCF 17h,1
INCF 19h,1
;19h is pointer for button B
DECFSZ 1A,1
GOTO Main7
GOTO Main5
END

Experiment-13 for "5x7 Display" Project


;PIC16F84 and only F84 chip
; 0-9 Up Counter
Start ORG 0x00
BSF 03,5
MOVLW 0Ch
MOVWF 05h
MOVLW 00h
MOVWF 06h
BCF 03,5
GOTO Main
Table1 ADDWF 02h,1
RETLW 3Eh
RETLW 41h
RETLW 41h
RETLW 41h
RETLW 3Eh
RETLW 00h
RETLW 10h
RETLW 20h
RETLW 7Fh
RETLW 00h
RETLW 27h
RETLW 49h
RETLW 49h
RETLW 49h
RETLW 31h
RETLW 22h
RETLW 41h
RETLW 49h
RETLW 49h
RETLW 36h
RETLW 0Ch
RETLW 14h
RETLW 24h
RETLW 7Fh
RETLW 04h
RETLW 7Ah
RETLW 49h
RETLW 49h
RETLW 49h
RETLW 46h
RETLW 3Eh
RETLW 49h
RETLW 49h
RETLW 49h
RETLW 26h
RETLW 40h
RETLW 47h
RETLW 48h
RETLW 50h
RETLW 60h
RETLW 36h
RETLW 49h
RETLW 49h
RETLW 49h
RETLW 36h
RETLW 32h
RETLW 49h
RETLW 49h
RETLW 49h
RETLW 3Eh
RETLW 00h

;Go to page1 for setting-up the ports


;Put 0C into W
; to make RA2 & RA3 input
;Put 00 into W
;to make all RB lines output
;Go to Page0 for programming

;Add W to Program Counter


;0

;1

;2

;3

;4

;5

;6

;7

;8

;9

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

Clk

; LED can be illuminated

DECFSZ 1Bh,1
GOTO DelA
MOVLW 00h
MOVWF 06
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
MOVLW 11h
MOVWF 04
FillGh2 MOVF 17h,0
CALL Table1
MOVWF 00
INCF 04h,1
INCF 17h,1
DECFSZ 18h,1
GOTO FillGh2
RETURN

;5 cycles of Loading
;Move start of Ghost locations to FSR
;Move table pointer to W
;Move W to INDF (move into what FSR looks at)
;Increment the FSR to look at next file

;MAIN ROUTINE
Main

MOVLW 00
MOVWF 17h
CALL FillGh
Main1 BCF 1E,5
Main2 CALL Ghost
BTFSC 05h,2
GOTO Main3
GOTO Main1
BTFSC 1E,5
GOTO Main2
MOVF 17h,0
XORLW 32h
BTFSS 03,2
GOTO Main4
MOVLW 00
MOVWF 17h
Main4 CALL FillGh
BSF 1E,5
GOTO Main2

;Load Table1 pointer with 00


;Put "0" on Screen
;Display whatever is in Ghost files
;Test for buttonA
;Pushed
;Not pushed

Main3

END

;Has pointer reached end of table?


;End of Table is 32h bytes.
;Test the zero flag

;No. Put next number on screen


;Set the button flag

EXPERIMENTO-17

ANIMATION-1

En 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 CLULA


Cada 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 04
Para activar las 15h del archivo quinta columna deben ser cargados con 55h Por Ejemplo 2: 11h archivos deben cargarse con
22h 12h archivo debe cargarse con 1EH 13h archivo debe ser cargado con 07h 14h archivo debe ser cargado con 71h 15h
archivo debe ser cargado con 7Fh La 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-17 for "5x7 Display" Project


;PIC16F84 and only F84 chip
; Display example1 for 1/2 sec:
Start

ORG 0x00
BSF 03,5
MOVLW 00h
MOVWF 05h
MOVWF 06h
BCF 03,5
GOTO Main

Frame1 MOVLW 1Ch


MOVWF 11h
MOVLW 6Eh
MOVWF 12h
MOVLW 39h
MOVWF 13h
MOVLW 04h
MOVWF 14h
MOVLW 55h
MOVWF 15h
BSF 05,1
NOP
BCF 05,1
MOVF 11h,0
MOVWF 06h
CALL DelD
MOVF 12h,0
MOVWF 06h
CALL DelD
MOVF 13h,0
MOVWF 06h
CALL DelD
MOVF 14h,0
MOVWF 06h
CALL DelD
MOVF 15h,0
MOVWF 06h
CALL DelD
RETURN
DelD

Clk

Main
Main1

Main2

DECFSZ 1Bh,1
GOTO DelD
MOVLW 00h
MOVWF 06
BSF 05,0
NOP
BCF 05,0
RETURN
MOVLW 50h
MOVWF 0Ch
CALL Frame1
DECFSZ 0Ch
GOTO Main1
NOP
NOP
GOTO Main2
END

;Go to page1 for setting-up the ports


;Put 00 into W
;to make port 5 (port A) all output
;and make port 6 (port B) all output
;Go to page0 for programming

;place the 5 values into the 5


; files to produce the pattern
; shown in example1 above.

;Reset 4017

;Move file 11 into W

;Move file 12 into W

;Move file 13 into W

;Move file 14 into W

;Move file 15 into W

;Zero port B to prevent mirroring


;Clock the 4017

;Each 10h represents 100mS (10 frames/sec)


;Display frame1 for 1/2 sec

;Do-nothing loop
; Reset power to view screen again

EXPERIMENTO-18

ANIMATION-2

En 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 celda
La 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-18 for "5x7 Display" Project


;PIC16F84 and only F84 chip
;5-cell animation
Start ORG 0x00
BSF 03,5
MOVLW 00h
MOVWF 05h
MOVWF 06h
BCF 03,5
GOTO Main

;Go to page1 for setting-up the ports


;Put 00 into W
;to make port 5 (port A) all output
;and make port 6 (port B) all output
;Go to page0 for programming

Cell1

MOVLW 01h
MOVWF 11h
MOVLW 01h
MOVWF 12h
MOVLW 01h
MOVWF 13h
MOVLW 01h
MOVWF 14h
MOVLW 01h
MOVWF 15h
GOTO Scan

;place the 5 values into the 5


; files to produce the first cell
; as shown above.

Cell2

MOVLW 08h
MOVWF 11h
MOVLW 04h
MOVWF 12h
MOVLW 04h
MOVWF 13h
MOVLW 02h
MOVWF 14h
MOVLW 01h
MOVWF 15h
GOTO Scan

;place the 5 values into the 5


; files to produce the second cell
; as shown above.

Cell3

MOVLW 40h
MOVWF 11h
MOVLW 20h
MOVWF 12h
MOVLW 08h
MOVWF 13h

;place the 5 values into the 5


; files to produce the third cell
; as shown above.

MOVLW 04h
MOVWF 14h
MOVLW 01h
MOVWF 15h
GOTO Scan
Cell4

MOVLW 00h
MOVWF 11h
MOVLW 00h
MOVWF 12h
MOVLW 60h
MOVWF 13h
MOVLW 1Eh
MOVWF 14h
MOVLW 01h
MOVWF 15h
GOTO Scan

;place the 5 values into the 5


; files to produce the fourth cell
; as shown above.

Cell5

MOVLW 00h
MOVWF 11h
MOVLW 00h
MOVWF 12h
MOVLW 00h
MOVWF 13h
MOVLW 00h
MOVWF 14h
MOVLW 7Fh
MOVWF 15h
GOTO Scan

;place the 5 values into the 5


; files to produce the fifth cell
; as shown above.

Scan

BSF 05,1
NOP
BCF 05,1
MOVF 11h,0
MOVWF 06h
CALL DelD
MOVF 12h,0
MOVWF 06h
CALL DelD
MOVF 13h,0
MOVWF 06h
CALL DelD
MOVF 14h,0
MOVWF 06h
CALL DelD
MOVF 15h,0
MOVWF 06h
CALL DelD
RETURN

;Reset 4017

DelD

Clk

Main
Main1

Main2

Main3

Main4

Main5

;Move file 11 into W


;Move file 12 into W
;Move file 13 into W
;Move file 14 into W
;Move file 15 into W

DECFSZ 1Bh,1
GOTO DelD
MOVLW 00h
;Zero port B to prevent mirroring
MOVWF 06
BSF 05,0
;Clock the 4017
NOP
BCF 05,0
RETURN
MOVLW 50h
MOVWF 0Ch
CALL Cell1
DECFSZ 0Ch,1
GOTO Main1
MOVLW 40h
MOVWF 0Ch
CALL Cell2
DECFSZ 0Ch,1
GOTO Main2
MOVLW 30h
MOVWF 0Ch
CALL Cell3
DECFSZ 0Ch,1
GOTO Main3
MOVLW 20h
MOVWF 0Ch
CALL Cell4
DECFSZ 0Ch,1
GOTO Main4
MOVLW 10h
MOVWF 0Ch
CALL Cell5
DECFSZ 0Ch,1
GOTO Main5
GOTO Main
END

;Each 10h represents 100mS


;Display Cell 1 for 1/2 sec
;Each 10h represents 100mS
;Display Cell 2 for 400mS
;Each 10h represents 100mS
;Display Cell 3 for 300mS
;Each 10h represents 100mS
;Display Cell 4 for 200mS
;Each 10h represents 100mS (10 frames/sec)
;Display Cell 5 for 100mS

EXPERIMENTO 1- 9

-ANIMACIN 3

Este 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 WipeUp
Aadir WipeUp al programa en el experimento 18.
Insertar al final, as:
GOTO Main 5
CALL WipeUp
GOTO Main

Experiment-19 for "5x7 Display" Project


;PIC16F84 and only F84 chip
;Sub-routine "WipeUp"
WipeUp MOVLW 0FFh
MOVWF 11h
MOVWF 12h
MOVWF 13h
MOVWF 14h
MOVWF 15h
MOVLW 20h
MOVWF 0Ch
XX
BCF 11h,0
RLF 11h,1
BCF 12h,0
RLF 12h,1
BCF 13h,0
RLF 13h,1
BCF 14h,0
RLF 14h,1
BCF 15h,0
RLF 15h,1
BTFSS 15h,7
RETURN
YY
DECFSZ 0ch,1
GOTO ZZ
GOTO XX
ZZ
CALL Scan
GOTO YY
Scan
END

Experiment-19a for "5x7 Display" Project


;PIC16F84 and only F84 chip
;Experiments 18 & 19 combined:
Start ORG 0x00
BSF 03,5
MOVLW 00h
MOVWF 05h
MOVWF 06h
BCF 03,5
GOTO Main
Cell1

MOVLW 01h
MOVWF 11h
MOVLW 01h
MOVWF 12h
MOVLW 01h
MOVWF 13h
MOVLW 01h
MOVWF 14h
MOVLW 01h
MOVWF 15h
GOTO Scan

Cell2

MOVLW 08h
MOVWF 11h

;Go to page1 for setting-up the ports


;Put 00 into W
;to make port 5 (port A) all output
;and make port 6 (port B) all output
;Go to page0 for programming

;place the 5 values into the 5


; files to produce the first cell
; as shown above.

;place the 5 values into the 5


; files to produce the second cell

MOVLW 04h
MOVWF 12h
MOVLW 04h
MOVWF 13h
MOVLW 02h
MOVWF 14h
MOVLW 01h
MOVWF 15h
GOTO Scan

; as shown above.

Cell3

MOVLW 40h
MOVWF 11h
MOVLW 20h
MOVWF 12h
MOVLW 08h
MOVWF 13h
MOVLW 04h
MOVWF 14h
MOVLW 01h
MOVWF 15h
GOTO Scan

;place the 5 values into the 5


; files to produce the third cell
; as shown above.

Cell4

MOVLW 00h
MOVWF 11h
MOVLW 00h
MOVWF 12h
MOVLW 60h
MOVWF 13h
MOVLW 1Eh
MOVWF 14h
MOVLW 01h
MOVWF 15h
GOTO Scan

;place the 5 values into the 5


; files to produce the fourth cell
; as shown above.

Cell5

MOVLW 00h
MOVWF 11h
MOVLW 00h
MOVWF 12h
MOVLW 00h
MOVWF 13h
MOVLW 00h
MOVWF 14h
MOVLW 7Fh
MOVWF 15h
GOTO Scan

;place the 5 values into the 5


; files to produce the fifth cell
; as shown above.

Scan

BSF 05,1
NOP
BCF 05,1
MOVF 11h,0
MOVWF 06h
CALL DelD
MOVF 12h,0
MOVWF 06h
CALL DelD
MOVF 13h,0
MOVWF 06h
CALL DelD
MOVF 14h,0
MOVWF 06h
CALL DelD
MOVF 15h,0
MOVWF 06h
CALL DelD
RETURN

;Reset 4017

DelD

Clk

;Move file 11 into W


;Move W to output port6
;Move file 12 into W

;Move file 13 into W

;Move file 14 into W

;Move file 15 into W

DECFSZ 1Bh,1
GOTO DelD
MOVLW 00h
;Zero port B to prevent mirroring
MOVWF 06
BSF 05,0
;Clock the 4017
NOP
BCF 05,0
RETURN

WipeUp MOVLW 0FFh


MOVWF 11h

MOVWF 12h
MOVWF 13h
MOVWF 14h
MOVWF 15h
MOVLW 80h
MOVWF 0Ch
GOTO YY
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
RETURN
DECFSZ 0Ch,1
GOTO ZZ
MOVLW 80h
MOVWF 0Ch
GOTO XX
CALL Scan
GOTO YY

XX

YY

ZZ
Main
Main1

Main2

Main3

Main4

Main5

MOVLW 50h
MOVWF 0Ch
CALL Cell1
DECFSZ 0Ch,1
GOTO Main1
MOVLW 40h
MOVWF 0Ch
CALL Cell2
DECFSZ 0Ch,1
GOTO Main2
MOVLW 30h
MOVWF 0Ch
CALL Cell3
DECFSZ 0Ch,1
GOTO Main3
MOVLW 20h
MOVWF 0Ch
CALL Cell4
DECFSZ 0Ch,1
GOTO Main4
MOVLW 80h
MOVWF 0Ch
CALL Cell5
DECFSZ 0Ch,1
GOTO Main5
CALL WipeUp
GOTO Main

;Each 10h represents 100mS


;Display Cell 1 for 1/2 sec
;Each 10h represents 100mS
;Display Cell 2 for 400mS
;Each 10h represents 100mS
;Display Cell 3 for 300mS
;Each 10h represents 100mS
;Display Cell 4 for 200mS
;Each 10h represents 100mS
;Display Cell 5 for 800mS

END

GOTO principal 5

EXPERIMENTO-20

ANIMATION-4

Este 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
nuestra biblioteca de rutinas captulo.
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-20 for "5x7 Display" Project


;PIC16F84 and only F84 chip
; 5-cell animation with WipeUp and WipeDown.

Start

ORG 0x00
BSF 03,5
MOVLW 00h
MOVWF 05h
MOVWF 06h
BCF 03,5
GOTO Main

;Go to page1 for setting-up the ports


;Put 00 into W
;to make port 5 (port A) all output
;and make port 6 (port B) all output
;Go to page0 for programming

Cell1 MOVLW 01h


MOVWF 11h
MOVLW 01h
MOVWF 12h
MOVLW 01h
MOVWF 13h
MOVLW 01h
MOVWF 14h
MOVLW 01h
MOVWF 15h
GOTO Scan

;place the 5 values into the 5


; files to produce the first cell
; as shown above.

Cell2 MOVLW 08h


MOVWF 11h
MOVLW 04h
MOVWF 12h
MOVLW 04h
MOVWF 13h
MOVLW 02h
MOVWF 14h
MOVLW 01h
MOVWF 15h
GOTO Scan

;place the 5 values into the 5


; files to produce the second cell
; as shown above.

Cell3 MOVLW 40h


MOVWF 11h
MOVLW 20h
MOVWF 12h
MOVLW 08h
MOVWF 13h
MOVLW 04h
MOVWF 14h
MOVLW 01h
MOVWF 15h
GOTO Scan

;place the 5 values into the 5


; files to produce the third cell
; as shown above.

Cell4 MOVLW 00h


MOVWF 11h
MOVLW 00h
MOVWF 12h
MOVLW 60h
MOVWF 13h
MOVLW 1Eh
MOVWF 14h
MOVLW 01h
MOVWF 15h
GOTO Scan

;place the 5 values into the 5


; files to produce the fourth cell
; as shown above.

Cell5 MOVLW 00h


MOVWF 11h
MOVLW 00h
MOVWF 12h
MOVLW 00h
MOVWF 13h
MOVLW 00h
MOVWF 14h
MOVLW 7Fh
MOVWF 15h
GOTO Scan

;place the 5 values into the 5


; files to produce the fifth cell
; as shown above.

Scan BSF 05,1


NOP
BCF 05,1
MOVF 11h,0
MOVWF 06h
CALL DelD
MOVF 12h,0
MOVWF 06h
CALL DelD
MOVF 13h,0
MOVWF 06h
CALL DelD
MOVF 14h,0
MOVWF 06h
CALL DelD
MOVF 15h,0
MOVWF 06h
CALL DelD
RETURN

;Reset 4017
;Move file 11 into W
;Move file 12 into W
;Move file 13 into W
;Move file 14 into W
;Move file 15 into W

DelD

Clk

DECFSZ 1Bh,1
GOTO DelD
MOVLW 00h
MOVWF 06
BSF 05,0
NOP
BCF 05,0
RETURN

;Zero port B to prevent mirroring


;Clock the 4017

WipeUp MOVLW 0FFh


MOVWF 11h
MOVWF 12h
MOVWF 13h
MOVWF 14h
MOVWF 15h
MOVLW 80h
MOVWF 0Ch
GOTO YY
XX
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
RETURN
YY
DECFSZ 0Ch,1
GOTO ZZ
MOVLW 80h
MOVWF 0Ch
GOTO XX
ZZ
CALL Scan
GOTO YY
WDown MOVLW 0FFh
MOVWF 11h
MOVWF 12h
MOVWF 13h
MOVWF 14h
MOVWF 15h
MOVLW 80h
MOVWF 0Ch
GOTO BB
AA
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,7
BB
DECFSZ 0Ch,1
GOTO CC
MOVLW 80h
MOVWF 0Ch
BTFSS 15h,0
RETURN
GOTO AA
CC
CALL Scan
GOTO BB
Main
Main1

MOVLW 0F0h ;Each 10h represents 100mS


MOVWF 0Ch
CALL Cell1 ;Display Cell 1 for 1/2 sec
DECFSZ 0Ch,1
GOTO Main1

Main2

MOVLW 40h ;Each 10h represents 100mS


MOVWF 0Ch
CALL Cell2 ;Display Cell 2 for 400mS
DECFSZ 0Ch,1
GOTO Main2

Main3

MOVLW 30h ;Each 10h represents 100mS


MOVWF 0Ch
CALL Cell3 ;Display Cell 3 for 300mS
DECFSZ 0Ch,1
GOTO Main3

Main4

MOVLW 20h ;Each 10h represents 100mS


MOVWF 0Ch
CALL Cell4 ;Display Cell 4 for 200mS

DECFSZ 0Ch,1
GOTO Main4

Main5

MOVLW 80h ;Each 10h represents 100mS


MOVWF 0Ch
CALL Cell5 ;Display Cell 5 for 800mS
DECFSZ 0Ch,1
GOTO Main5
CALL WipeUp
CALL WDown
GOTO Main
END

EXPERIMENTO-21

-5 ANIMACIN

Este 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 el Tajo sub-rutina y ShiftUp sub-rutina y aadirLLAMADA
raya vertical en 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-21 for "5x7 Display" Project


;PIC16F84 and only F84 chip
;SLASH animation

Start ORG 0x00


BSF 03,5
MOVLW 00h
MOVWF 05h
MOVWF 06h
BCF 03,5
GOTO Main

;Go to page1 for setting-up the ports


;Put 00 into W
;to make port 5 (port A) all output
;and make port 6 (port B) all output
;Go to page0 for programming

Slash BCF 03h,0


;Clear the carry bit
MOVLW 00h
MOVWF 11h
MOVWF 12h
MOVWF 13h
MOVWF 14h
MOVWF 15h
BSF 11h,0
CALL ShiftUp
BSF 12h,0
CALL ShiftUp
BSF 13h,0
CALL ShiftUp
BSF 14h,0
CALL ShiftUp
BSF 15h,0
CALL ShiftUp
CALL ShiftUp
CALL ShiftUp
BCF 11h,7
CALL ShiftUp
BCF 12h,7
CALL ShiftUp
BCF 13h,7
CALL ShiftUp
BCF 14h,7
CALL ShiftUp
RETURN
ShiftUp MOVLW 20h
MOVWF 0Ch
Shift1 DECFSZ 0Ch,1
GOTO Shift2
RLF 11h,1
RLF 12h,1
RLF 13h,1
RLF 14h,1
RLF 15h,1
RETURN
Shift2 CALL Scan
GOTO Shift1
Scan BSF 05,1
NOP
BCF 05,1
MOVF 11h,0
MOVWF 06h
CALL DelD
MOVF 12h,0
MOVWF 06h
CALL DelD
MOVF 13h,0
MOVWF 06h
CALL DelD
MOVF 14h,0
MOVWF 06h
CALL DelD
MOVF 15h,0
MOVWF 06h
CALL DelD
RETURN
DelD

;Reset 4017
;Move file 11 into W
;Move file 12 into W
;Move file 13 into W
;Move file 14 into W
;Move file 15 into W

DECFSZ 1Bh,1
GOTO DelD
MOVLW 00h
;Zero port B to prevent mirroring
MOVWF 06
Clk
BSF 05,0
;Clock the 4017
NOP
BCF 05,0
RETURN
Main CALL Slash
;Display Slash
GOTO Main

END

EXPERIMENTO- 22

ANIMATION- 6

He 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 eficaz

Experiment-22 for "5x7 Display" Project


;PIC16F84 and only F84 chip
;SPLASH
Start ORG 0x00
BSF 03,5
MOVLW 00h
MOVWF 05h
MOVWF 06h
BCF 03,5
GOTO Main
Cell1 MOVLW 00h
MOVWF 11h
MOVLW 00h
MOVWF 12h
MOVLW 08h
MOVWF 13h
MOVLW 00h

;Go to page1 for setting-up the ports


;Put 00 into W
;to make port 5 (port A) all output
;and make port 6 (port B) all output
;Go to page0 for programming

;place the 5 values into the 5


; files to produce the first cell
; as shown above.

MOVWF 14h
MOVLW 00h
MOVWF 15h
GOTO Scan
Cell2 MOVLW 00h
MOVWF 11h
MOVLW 1Ch
MOVWF 12h
MOVLW 14h
MOVWF 13h
MOVLW 1Ch
MOVWF 14h
MOVLW 00h
MOVWF 15h
GOTO Scan

;place the 5 values into the 5


; files to produce the second cell
; as shown above.

Cell3 MOVLW 3Eh


MOVWF 11h
MOVLW 22h
MOVWF 12h
MOVLW 22h
MOVWF 13h
MOVLW 22h
MOVWF 14h
MOVLW 3Eh
MOVWF 15h
GOTO Scan

;place the 5 values into the 5


; files to produce the third cell
; as shown above.

Cell4

MOVLW 41h
MOVWF 11h
MOVLW 41h
MOVWF 12h
MOVLW 41h
MOVWF 13h
MOVLW 41h
MOVWF 14h
MOVLW 41h
MOVWF 15h
GOTO Scan

Cell5 MOVLW 00h


MOVWF 11h
MOVLW 00h
MOVWF 12h
MOVLW 00h
MOVWF 13h
MOVLW 00h
MOVWF 14h
MOVLW 00h
MOVWF 15h
GOTO Scan
Scan BSF 05,1
NOP
BCF 05,1
MOVF 11h,0
MOVWF 06h
CALL DelD
MOVF 12h,0
MOVWF 06h
CALL DelD
MOVF 13h,0
MOVWF 06h
CALL DelD
MOVF 14h,0
MOVWF 06h
CALL DelD
MOVF 15h,0
MOVWF 06h
CALL DelD
RETURN
DelD

DECFSZ 1Bh,1
GOTO DelD
MOVLW 00h
MOVWF 06

;place the 5 values into the 5


; files to produce the fourth cell
; as shown above.

;The fifth cell is blank

;Reset 4017

;Move file 11 into W

;Move file 12 into W

;Move file 13 into W

;Move file 14 into W

;Move file 15 into W

;Zero port B to prevent mirroring

Clk

BSF 05,0
NOP
BCF 05,0
RETURN

;Clock the 4017

Main

MOVLW 50h
MOVWF 0Ch
Main1 CALL Cell1
DECFSZ 0Ch
GOTO Main1

;Each 10h represents 100mS

MOVLW 10h
MOVWF 0Ch
Main2 CALL Cell2
DECFSZ 0Ch
GOTO Main2

;Each 10h represents 100mS

MOVLW 10h
MOVWF 0Ch
Main3 CALL Cell3
DECFSZ 0Ch
GOTO Main3

;Each 10h represents 100mS

MOVLW 10h
MOVWF 0Ch
Main4 CALL Cell4
DECFSZ 0Ch
GOTO Main4

;Each 10h represents 100mS

MOVLW 80h
MOVWF 0Ch
Main5 CALL Cell5
DECFSZ 0Ch
GOTO Main5
GOTO Main

;Each 10h represents 100mS

;Display Cell 1 for 1/2 sec

;Display Cell 2 for 100mS

;Display Cell 3 for 100mS

;Display Cell 4 for 100mS

;Display Cell 5 for 800mS

END

Experimentos

Pgina 9

EXPERIMENTO-23
Este 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 veces en 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-23 for "5x7 Display" Project


;PIC16F84 and only F84 chip
;Press button A for SPLASH! - with debounce
Start

Cell1

ORG 0x00
BSF 03,5
MOVLW 04h
MOVWF 05h
MOVLW 00h
MOVWF 06h
BCF 03,5
GOTO Main
MOVLW 00h
MOVWF 11h
MOVLW 00h

;Go to page1 for setting-up the ports


;Put 04 into W
; to make RA2 input
;Put 00 into W
;and make port 6 (port B) all output
;Go to page0 for programming
;place the 5 values into the 5
; files to produce the first cell
; as shown above.

MOVWF 12h
MOVLW 08h
MOVWF 13h
MOVLW 00h
MOVWF 14h
MOVLW 00h
MOVWF 15h
GOTO Scan
Cell2

MOVLW 00h
MOVWF 11h
MOVLW 1Ch
MOVWF 12h
MOVLW 14h
MOVWF 13h
MOVLW 1Ch
MOVWF 14h
MOVLW 00h
MOVWF 15h
GOTO Scan

Cell3

MOVLW 3Eh
MOVWF 11h
MOVLW 22h
MOVWF 12h
MOVLW 22h
MOVWF 13h
MOVLW 22h
MOVWF 14h
MOVLW 3Eh
MOVWF 15h
GOTO Scan

;place the 5 values into the 5


; files to produce the third cell
; as shown above.

Cell4

MOVLW 41h
MOVWF 11h
MOVLW 41h
MOVWF 12h
MOVLW 41h
MOVWF 13h
MOVLW 41h
MOVWF 14h
MOVWF 15h
GOTO Scan

;place the 5 values into the 5


; files to produce the fourth cell
; as shown above.

Cell5

MOVLW 00h
MOVWF 11h
MOVLW 00h
MOVWF 12h
MOVLW 00h
MOVWF 13h
MOVLW 00h
MOVWF 14h
MOVLW 00h
MOVWF 15h
GOTO Scan

;place the 5 values into the 5


; files to produce the fifth cell
; as shown above.

Scan

BSF 05,1
NOP
BCF 05,1
MOVF 11h,0
MOVWF 06h
CALL DelD
MOVF 12h,0
MOVWF 06h
CALL DelD
MOVF 13h,0
MOVWF 06h
CALL DelD
MOVF 14h,0
MOVWF 06h
CALL DelD
MOVF 15h,0
MOVWF 06h
CALL DelD
RETURN

DelD

Clk

Splash
Splash1

;place the 5 values into the 5


; files to produce the second cell
; as shown above.

;Reset 4017
;Move file 11 into W

DECFSZ 1Bh,1
GOTO DelD
MOVLW 00h
MOVWF 06
BSF 05,0
NOP
BCF 05,0
RETURN
MOVLW 50h
MOVWF 0Ch
CALL Cell1

;Move file 12 into W


;Move file 13 into W
;Move file 14 into W
;Move file 15 into W

;Zero port B to prevent mirroring


;Clock the 4017

;Each 10h represents 100mS


;Display Cell 1 for 1/2 sec

Splash2

Splash3

Splash4

Splash5

DECFSZ 0Ch
GOTO Splash1
MOVLW 10h
;Each 10h represents 100mS
MOVWF 0Ch
CALL Cell2
;Display Cell 2 for 100mS
DECFSZ 0Ch
GOTO Splash2
MOVLW 10h
;Each 10h represents 100mS
MOVWF 0Ch
CALL Cell3
;Display Cell 3 for 100mS
DECFSZ 0Ch
GOTO Splash3
MOVLW 10h
;Each 10h represents 100mS
MOVWF 0Ch
CALL Cell4
;Display Cell 4 for 100mS
DECFSZ 0Ch
GOTO Splash4
MOVLW 08h
;Each 10h represents 100mS
MOVWF 0Ch
CALL Cell5
;Display Cell 5 for 50mS
DECFSZ 0Ch
GOTO Splash5
RETURN

Main

MOVLW 40h
MOVWF 1Dh
Main1 BTFSC 05,2
GOTO Main2
MOVF 1Dh,0
XORLW 00
BTFSC 03,2
GOTO Main1
DECF 1Dh,1
GOTO Main1
Main2 MOVF 1Dh,0
XORLW 00
BTFSS 03,2
GOTO Main1
CALL Splash
GOTO Main

;Test for button A. NOT pressed line = LOW


;Pressed
;Not pressed
;Is file 1D = 0?
;Yes
;No. Decrement Debounce file
;Move file 1D to W
;Is file 1D = 0? Is the zero-flag SET?
;No
;Yes

END

EXPERIMENTO-24
Esta 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-24 for "5x7 Display" Project


;PIC16F84 and only F84 chip
;Press button A to START/STOP Splash animation

Start

Cell1

ORG 0x00
BSF 03,5
MOVLW 04h
MOVWF 05h
MOVLW 00h
MOVWF 06h
BCF 03,5
GOTO Main
MOVLW 00h
MOVWF 11h
MOVLW 00h
MOVWF 12h
MOVLW 08h
MOVWF 13h
MOVLW 00h
MOVWF 14h
MOVLW 00h

;Go to page1 to set-up the ports


;Put 04 into W
; to make RA2 input
;Put 00 into W
;and make port 6 (port B) all output
;Go to page0 for programming

;place the 5 values into the 5


; files to produce the first cell
; as shown above.

MOVWF 15h
GOTO Scan
Cell2

MOVLW 00h
MOVWF 11h
MOVLW 1Ch
MOVWF 12h
MOVLW 14h
MOVWF 13h
MOVLW 1Ch
MOVWF 14h
MOVLW 00h
MOVWF 15h
GOTO Scan

;place the 5 values into the 5


; files to produce the second cell
; as shown above.

Cell3

MOVLW 3Eh
MOVWF 11h
MOVLW 22h
MOVWF 12h
MOVLW 22h
MOVWF 13h
MOVLW 22h
MOVWF 14h
MOVLW 3Eh
MOVWF 15h
GOTO Scan

;place the 5 values into the 5


; files to produce the third cell
; as shown above.

Cell4

MOVLW 41h
MOVWF 11h
MOVLW 41h
MOVWF 12h
MOVLW 41h
MOVWF 13h
MOVLW 41h
MOVWF 14h
MOVLW 41h
MOVWF 15h
GOTO Scan

;place the 5 values into the 5


; files to produce the fourth cell
; as shown above.

Cell5

MOVLW 00h
MOVWF 11h
MOVLW 00h
MOVWF 12h
MOVLW 00h
MOVWF 13h
MOVLW 00h
MOVWF 14h
MOVLW 00h
MOVWF 15h
GOTO Scan

;place the 5 values into the 5


; files to produce the fifth cell
; as shown above.

Scan

BSF 05,1
NOP
BCF 05,1
MOVF 11h,0
MOVWF 06h
CALL DelD
MOVF 12h,0
MOVWF 06h
CALL DelD
MOVF 13h,0
MOVWF 06h
CALL DelD
MOVF 14h,0
MOVWF 06h
CALL DelD
MOVF 15h,0
MOVWF 06h
CALL DelD
RETURN

DelD

Del1
Del2

BTFSC 05,2
GOTO Del1
BCF 1E,4
GOTO Del2
BSF 1E,4
DECFSZ 1Bh,1

;Reset 4017

;Move file 11 into W

;Move file 12 into W

;Move file 13 into W

;Move file 14 into W

;Move file 15 into W

;A pushed? Pushed = HIGH


;Clear the button-pushed flag
;Set the button-pushed flag

Clk

GOTO Del2
MOVLW 00h
MOVWF 06
BSF 05,0
NOP
BCF 05,0
BTFSS 05,2
RETURN
BTFSC 1E,4
RETURN
BCF 1E,5
RETURN

;Zero port B to prevent mirroring


;Clock the 4017

;A pushed?
;A not pushed
;Has the button been released?
;No.
;Yes. Don't send Micro to SPLASH

Splash

MOVLW 50h
MOVWF 0Ch
Splash1 CALL Cell1
DECFSZ 0Ch
GOTO Splash1

;Each 10h represents 100mS


;Display Cell 1 for 1/2 sec

MOVLW 10h
MOVWF 0Ch
Splash2 CALL Cell2
DECFSZ 0Ch
GOTO Splash2

;Each 10h represents 100mS

MOVLW 10h
MOVWF 0Ch
Splash3 CALL Cell3
DECFSZ 0Ch
GOTO Splash3

;Each 10h represents 100mS

MOVLW 10h
MOVWF 0Ch
Splash4 CALL Cell4
DECFSZ 0Ch
GOTO Splash4

;Each 10h represents 100mS

MOVLW 08h
MOVWF 0Ch
Splash5 CALL Cell5
DECFSZ 0Ch
GOTO Splash5
RETURN

;Each 10h represents 100mS

Main

BCF 1E,5
BCF 1E,4
Main1 BTFSS 05,2
GOTO Main2
BSF 1E,5
CALL Splash
GOTO Main1
Main2 BTFSS 1E,5
GOTO Main1
CALL Splash
GOTO Main1
END

;Display Cell 2 for 100mS

;Display Cell 3 for 100mS

;Display Cell 4 for 100mS

;Display Cell 5 for 50mS

;This flag sends micro to SPLASH


;This flag detects button NOT pressed
;Is button A pushed? Pushed = HIGH
;Not pressed
;Pressed. Set 1E,5 flag

You might also like