HomeArticlesProjectsBlogContact
Articles
5x7 Display
Colin Mitchell
Colin Mitchell
Make sure to subscribe to our newsletter and be the first to know the news.

Table Of Contents

01
Experiments
02
EXPERIMENT-17 ANIMATION-1
03
EXPERIMENT-18 ANIMATION-2
04
EXPERIMENT-19 ANIMATION-3

Experiments

Page7


EXPERIMENT-17 ANIMATION-1

In a previous experiment we showed how to scroll words across the screen. In this experiment we go one step further and show how to create animation on the screen. Animation is the basis to cartooning. A cartoon is made up of lots of frames called cells. These are individually drawn by hand (or computer) and a good-quality cartoon requires 12 cells per second. This means a 1-hour movie-length cartoon requires over 400,000. Each cell is “shot twice” because movie film requires 24 frames per second.
Our 5x7 Display is much simpler. It consists of 35 dots or pixels and when the screen is displaying a “Picture,” it is called a CELL.
Firstly we will show how to make a CELL and how to display it on the Video Screen for approx 1/10th of a second. This means you will need to produce 10 cells for each second of animation. Depending on the effect, you can a cell-rate or frame-rate as low as 1 frame per second or as high as 10 frames per second.

MAKING A CELL
Each picture or CELL is made up of 5x7 dots (=35 pixels) and the first thing to do is draw each of the frames of the animation on a “storey-board.” The diagram below shows three CELLS. The first CELL is blank. It shows how each of the 35 pixels has a hex value and file number. The first column has 7 spaces representing the first 7 LEDs on the screen. These LEDs have values starting at 01 for the bottom LED, then 02, 04, 08, 10, 20 and the top LED has the value 40. These values correspond to

the first 7 places in file 11h. The 8th location in the file (value 80h) is not used in this project. The second column corresponds to file 12h, then file 13h, 14h and 15h.
To turn on a particular LED, the corresponding hex value must be placed in one of the files. Each file will have a value from 00 to 7F. It’s really very simple when you know how. The bottom 4 LEDs are added together to get a value between 00 and 0F, while the top three LEDs are added together to get a value between 00 and 70. These two values are then put together to get a value from 00 to 7F. In the first column of example 1, LEDs 8 and 4 are required to be illuminated (we deal with the four lower LEDs first).

  • The fifteen hex values are: 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
  • LEDs 08 and 04 = nine, A, B, C. = C = 0C
  • To turn on the first column in example1, file 11h is loaded with 1C.
  • To turn on the second column: 08 + 04 + 02 = nine, A, B, C, D, E, = 0E The top two LEDs are 20 + 40 = 60. File 12h is loaded with 6E.
  • To turn on the third column: 08 + 01 = 09 10 + 20 = 30. File 13h must be loaded with 39h.
  • To turn on the fourth column: file 14h must be loaded with 04
  • To turn on the fifth column file 15h must be loaded with 55h

For example2:
File 11h must be loaded with 22h
File 12h must be loaded with 1Eh
File 13h must be loaded with 07h
File 14h must be loaded with 71h
File 15h must be loaded with 7Fh
The small letter “h” indicates the number is hexadecimal as “22” can be an “ordinary number - twenty two - or a hexadecimal 22 - equal to thirty four.

The final step is deciding the duration for each frame. It has been set at a default value of 2 frames per second. You can run your animation and change any of the values at any time.
You can add or delete a frame at any time. To add a frame simply place it in the program at the place where you want it to appear and give it a name. Frames do not have to be numbered. They are simply placed in the program and they will be displayed in that order.
Here is the program to display example 1(above) on the screen for 1/2sec. You will need to reset the micro after the program has displayed the picture for 1/2 sec. Slide the run/reset:program switch to pgm then to run/reset to view the program again.

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

Start   ORG 0x00
        BSF 03,5    ;Go to page1 for setting-up the ports
        MOVLW 00h   ;Put 00 into W
        MOVWF 05h   ;to make port 5 (port A) all output
        MOVWF 06h   ;and make port 6 (port B) all output
        BCF 03,5    ;Go to page0 for programming
        GOTO Main

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

        BSF 05,1     ;Reset 4017
        NOP
        BCF 05,1
        MOVF 11h,0   ;Move file 11 into W
        MOVWF 06h
        CALL DelD
        MOVF 12h,0   ;Move file 12 into W
        MOVWF 06h
        CALL DelD
        MOVF 13h,0   ;Move file 13 into W
        MOVWF 06h
        CALL DelD
        MOVF 14h,0   ;Move file 14 into W
        MOVWF 06h
        CALL DelD
        MOVF 15h,0   ;Move file 15 into W
        MOVWF 06h
        CALL DelD
        RETURN

DelD   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   MOVLW 50h    ;Each 10h represents 100mS (10 frames/sec)
       MOVWF 0Ch
Main1  CALL Frame1  ;Display frame1 for 1/2 sec
       DECFSZ 0Ch
       GOTO Main1
       NOP
Main2  NOP          ;Do-nothing loop
       GOTO Main2   ; Reset power to view screen again

  END

The block of numbers below is the HEX file for Experiment-17. Copy and paste it into a text program such as TEXTPAD or NOTEPAD and call it: Expt-17.hex

:10000000831600308500860083122B281C30910057
:100010006E309200393093000430940055309500D2
:100020008514000085101108860023201208860020
:100030002320130886002320140886002320150897
:100040008600232008009B0B23280030860005141F
:1000500000000510080050308C0006208C0B2D2865
:0600600000000000312841
:00000001FF

EXPERIMENT-18 ANIMATION-2

In this experiment we display 5 frames of an animation This will show how an animation or ‘CARTOON’ is created and how it can be expanded to any number of CELLS.
The first thing to do is draw the cells of the animation and work out the value for each of the LEDs. These values are then placed in the program.

To add an extra cell, name it cell6 and add the 11 lines of program to load the information into the 5 cells and GOTO Scan.
In the Main routine, put the 2 lines of code that determine how long the cell will appear on the screen, then: Main6 and the 3 lines of code that creates a loop to display the cell.
The animation can be extended to the end of memory and if the last instruction is GOTO Main, the animation will loop indefinitely.
In the next experiments we provide some routines you can add to your own animations.

Experiment-18 for “5x7 Display” Project
;PIC16F84 and only F84 chip
;5-cell animation

Start   ORG 0x00
        BSF 03,5    ;Go to page1 for setting-up the ports
        MOVLW 00h   ;Put 00 into W
        MOVWF 05h   ;to make port 5 (port A) all output
        MOVWF 06h   ;and make port 6 (port B) all output
        BCF 03,5    ;Go to page0 for programming
        GOTO Main

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

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

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

Cell4   MOVLW 00h   ;place the 5 values into the 5
        MOVWF 11h   ; files to produce the fourth cell
        MOVLW 00h   ; as shown above.
        MOVWF 12h
        MOVLW 60h
        MOVWF 13h
        MOVLW 1Eh
        MOVWF 14h
        MOVLW 01h
        MOVWF 15h
        GOTO Scan

Cell5   MOVLW 00h   ;place the 5 values into the 5
        MOVWF 11h   ; files to produce the fifth cell
        MOVLW 00h   ; as shown above.
        MOVWF 12h
        MOVLW 00h
        MOVWF 13h
        MOVLW 00h
        MOVWF 14h
        MOVLW 7Fh
        MOVWF 15h
        GOTO Scan

Scan    BSF 05,1     ;Reset 4017
        NOP
        BCF 05,1
        MOVF 11h,0   ;Move file 11 into W
        MOVWF 06h
        CALL DelD
        MOVF 12h,0   ;Move file 12 into W
        MOVWF 06h
        CALL DelD
        MOVF 13h,0   ;Move file 13 into W
        MOVWF 06h
        CALL DelD
        MOVF 14h,0   ;Move file 14 into W
        MOVWF 06h
        CALL DelD
        MOVF 15h,0   ;Move file 15 into W
        MOVWF 06h
        CALL DelD
        RETURN

DelD    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    MOVLW 50h   ;Each 10h represents 100mS
        MOVWF 0Ch
Main1   CALL Cell1  ;Display Cell 1 for 1/2 sec
        DECFSZ 0Ch,1
        GOTO Main1
        MOVLW 40h   ;Each 10h represents 100mS
        MOVWF 0Ch
Main2   CALL Cell2  ;Display Cell 2 for 400mS
        DECFSZ 0Ch,1
        GOTO Main2
        MOVLW 30h   ;Each 10h represents 100mS
        MOVWF 0Ch
Main3   CALL Cell3  ;Display Cell 3 for 300mS
        DECFSZ 0Ch,1
        GOTO Main3
        MOVLW 20h   ;Each 10h represents 100mS
        MOVWF 0Ch
Main4   CALL Cell4  ;Display Cell 4 for 200mS
        DECFSZ 0Ch,1
        GOTO Main4
        MOVLW 10h   ;Each 10h represents 100mS (10 frames/  sec)
        MOVWF 0Ch
Main5   CALL Cell5  ;Display Cell 5 for 100mS
        DECFSZ 0Ch,1
        GOTO Main5
        GOTO Main

  END

The block of numbers below is the HEX file for Experiment-18. Copy and paste it into a text program such as TEXTPAD or NOTEPAD and call it: Expt-18.hex

:100000008316003085008600831258280130910045
:1000100001309200013093000130940001309500CE
:100020003D280830910004309200043093000230E3
:100030009400013095003D2840309100203092001E
:100040000830930004309400013095003D280030C2
:10005000910000309200603093001E309400013017
:1000600095003D2800309100003092000030930050
:10007000003094007F3095003D28851400008510E5
:1000800011088600502012088600502013088600B0
:1000900050201408860050201508860050200800C3
:1000A0009B0B502800308600051400000510080046
:1000B00050308C0006208C0B5A2840308C001120C8
:1000C0008C0B5F2830308C001C208C0B6428203077
:1000D0008C0027208C0B692810308C0032208C0B70
:0400E0006E28582806
:00000001FF

EXPERIMENT-19 ANIMATION-3

This experiment is a sub-routine. It starts with a fully-illuminated screen and the rows turn off, from bottom to top. The routine is called WIPE-UP and can be included in any animation by calling WipeUp, thus: CALL WipeUp
Add WipeUp to the program in Experiment 18.
Insert it at the end, thus:
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

The block of numbers below is the HEX file for Experiment-19. Copy and paste it into a text program such as TEXTPAD or NOTEPAD and call it: Expt-19.hex

:10000000FF309100920093009400950020308C0006
:100010001110910D1210920D1310930D1410940DD8
:100020001510950D951F08008C0B1728082819200E
:02003000142892
:00000001FF

Experiment-19a for “5x7 Display” Project
;PIC16F84 and only F84 chip
;Experiments 18 & 19 combined:

Start   ORG 0x00
        BSF 03,5    ;Go to page1 for setting-up the ports
        MOVLW 00h   ;Put 00 into W
        MOVWF 05h   ;to make port 5 (port A) all output
        MOVWF 06h   ;and make port 6 (port B) all output
        BCF 03,5    ;Go to page0 for programming
        GOTO Main

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

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

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

Cell4   MOVLW 00h   ;place the 5 values into the 5
        MOVWF 11h   ; files to produce the fourth cell
        MOVLW 00h   ; as shown above.
        MOVWF 12h
        MOVLW 60h
        MOVWF 13h
        MOVLW 1Eh
        MOVWF 14h
        MOVLW 01h
        MOVWF 15h
        GOTO Scan

Cell5   MOVLW 00h   ;place the 5 values into the 5
        MOVWF 11h   ; files to produce the fifth cell
        MOVLW 00h   ; as shown above.
        MOVWF 12h
        MOVLW 00h
        MOVWF 13h
        MOVLW 00h
        MOVWF 14h
        MOVLW 7Fh
        MOVWF 15h
        GOTO Scan

Scan    BSF 05,1     ;Reset 4017
        NOP
        BCF 05,1
        MOVF 11h,0   ;Move file 11 into W
        MOVWF 06h    ;Move W to output port6
        CALL DelD
        MOVF 12h,0   ;Move file 12 into W
        MOVWF 06h
        CALL DelD
        MOVF 13h,0   ;Move file 13 into W
        MOVWF 06h
        CALL DelD
        MOVF 14h,0   ;Move file 14 into W
        MOVWF 06h
        CALL DelD
        MOVF 15h,0   ;Move file 15 into W
        MOVWF 06h
        CALL DelD
        RETURN

DelD    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

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

Main    MOVLW 50h    ;Each 10h represents 100mS
        MOVWF 0Ch
Main1   CALL Cell1   ;Display Cell 1 for 1/2 sec
        DECFSZ 0Ch,1
        GOTO Main1
        MOVLW 40h    ;Each 10h represents 100mS
        MOVWF 0Ch
Main2   CALL Cell2   ;Display Cell 2 for 400mS
        DECFSZ 0Ch,1
        GOTO Main2
        MOVLW 30h    ;Each 10h represents 100mS
        MOVWF 0Ch
Main3   CALL Cell3    ;Display Cell 3 for 300mS
        DECFSZ 0Ch,1
        GOTO Main3
        MOVLW 20h    ;Each 10h represents 100mS
        MOVWF 0Ch
Main4   CALL Cell4    ;Display Cell 4 for 200mS
        DECFSZ 0Ch,1
        GOTO Main4
        MOVLW 80h     ;Each 10h represents 100mS
        MOVWF 0Ch
Main5   CALL Cell5    ;Display Cell 5 for 800mS
        DECFSZ 0Ch,1
        GOTO Main5
        CALL WipeUp
        GOTO Main

  END

The block of numbers below is the HEX file for Experiment-19a. Copy and paste it into a text program such as TEXTPAD or NOTEPAD and call it: Expt-19a.hex

:100000008316003085008600831274280130910029
:1000100001309200013093000130940001309500CE
:100020003D280830910004309200043093000230E3
:100030009400013095003D2840309100203092001E
:100040000830930004309400013095003D280030C2
:10005000910000309200603093001E309400013017
:1000600095003D2800309100003092000030930050
:10007000003094007F3095003D28851400008510E5
:1000800011088600502012088600502013088600B0
:1000900050201408860050201508860050200800C3
:1000A0009B0B502800308600051400000510080046
:1000B000FF309100920093009400950080308C00F6
:1000C0006D28910D1110920D1210930D1310940DB7
:1000D0001410950D1510951F08008C0B7228803098
:1000E0008C0061283D206D28F0308C0006208C0BA0
:1000F000762840308C0011208C0B7B2830308C000F
:100100001C208C0B802820308C0027208C0B85280D
:0E01100080308C0032208C0B8A2858207428F6
:00000001FF

Go to the next page of experiments: 5x7 EXPERIMENTS: Page-8



Colin Mitchell

Colin Mitchell

Expertise

electronics
writing
PIC-Chips

Social Media

instagramtwitterwebsite

Related Posts

TODO
Transistor Test
© 2021, All Rights Reserved.

Quick Links

Advertise with usAbout UsContact Us

Social Media