Asm-code-check?

beenthere

Joined Apr 20, 2004
15,819
Always check for hardware problems first - if I interpret your post correctly, the display was running normally? It's easy to lose a wired connection.
 

hgmjr

Joined Jan 28, 2005
9,027
I am making the experiment from this page: http://users.tpg.com.au/users/talking/5x7_experiments_page4.html

I use a dot-matrix, but now the bottom row wont light up.
I have looked at the B0-pin, and I dont get any signal, so I figured that it must be the code?


- Thediabloman -
Since the device powers up with its IO lines in the input mode by default, it is entirely possible that you have not programmed the PIC IO line that controls the bottom row as an output and so it is still in input mode.

hgmjr
 

SgtWookie

Joined Jul 17, 2007
22,230
try disconnecting the resistor you have on the output. you do have a 100 ohm resistor on there, right? then see if you have an output signal. if you haven't been using current limiting resistors, you may have burned up the output.
 

Thread Starter

Thediabloman

Joined Mar 11, 2008
16
Thanks for the help.. I now got it to work, and I used a couple of 4017s get 5 7x5 matrix displays to sit together in a row. The scanning works perfect, and when I use the code from the link above I get the text that the code is making 5 times.

Now I would like to modify the code so that the text can scroll across all 5 displays.
I made this, but I am getting nothing when I put the 16F84 in the circuit.
Start ORG 0x00 ;This sets up the ports
BSF 03,5
MOVLW 00h
MOVWF 05h
MOVWF 06h
BCF 03,5
GOTO Run1

;Table1 holds the hex values for each column of LEDs

Table1 ADDWF 02h,1 ;Add W to Program Counter
RETLW 00h
RETLW 40h
RETLW 40h
RETLW 7Fh
RETLW 40h
RETLW 40h
RETLW 00h
RETLW 7Fh
RETLW 49h
RETLW 49h
RETLW 41h
RETLW 41h
RETLW 00h
RETLW 3Fh
RETLW 40h
RETLW 3Fh
RETLW 40h
RETLW 3Fh
RETLW 00h
RETLW 3Eh
RETLW 41h
RETLW 41h
RETLW 41h
RETLW 3Eh
RETLW 00h
RETLW 70h
RETLW 0Eh
RETLW 01h
RETLW 0Eh
RETLW 70h
RETLW 00h
RETLW 7Fh
RETLW 00h
RETLW 7Fh
RETLW 10h
RETLW 0Ch
RETLW 02h
RETLW 7Fh
RETLW 00h
RETLW 3Eh
RETLW 41h
RETLW 45h
RETLW 45h
RETLW 36h
RETLW 00h
RETLW 32h
RETLW 49h
RETLW 49h
RETLW 49h
RETLW 26h
RETLW 00h
RETLW 7Fh
RETLW 00h
RETLW 3Eh
RETLW 41h
RETLW 45h
RETLW 45h
RETLW 36h
RETLW 00h
RETLW 7Fh
RETLW 10h
RETLW 0Ch
RETLW 02h
RETLW 7Fh
RETLW 00h
RETLW 00h
RETLW 00h
RETLW 00h
RETLW 0FFh

Run1 CLRF 11h ;Clear the Ghost locations ready for starting
CLRF 12h
CLRF 13h
CLRF 14h
CLRF 15h
CLRF 16h
CLRF 17h
CLRF 18h
CLRF 19h
CLRF 1Ah
CLRF 0x1B
CLRF 1Ch
CLRF 0x1D
CLRF 1Eh
CLRF 1Fh
CLRF 20h
CLRF 21h
CLRF 22h
CLRF 23h
CLRF 24h
CLRF 25h
CLRF 26h
CLRF 27h
CLRF 28h

MOVLW 00
MOVWF 2Ah ;File 2Ah is the jump value for table
Run2 MOVLW 40h
MOVWF 29h ;File 29h counts the number of scans
CALL Shift ; and controls the "run speed"
INCF 2Ah,1
MOVF 2Ah,0 ;Put jump value into W
CALL Table1
MOVWF 2Bh ;W contains table data - put it in 15h
XORLW 0FFh ;If table value is FF,
BTFSC 03,2 ; bit 2 of file 3 will be SET (=1)
GOTO Run1 ;Start Table1 again
Run3 DECFSZ 29h,1 ;Scan the display 40h times
GOTO Run4
GOTO Run2
Run4 CALL Scan
GOTO Run3

Scan BSF 05,1 ;Reset 4017
NOP
BCF 05,1

MOVF 11h,0 ;Output the data at the 5 Ghost
MOVWF 06h ; locations to the display
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
MOVF 16h,0
MOVWF 06h
CALL DelD
MOVF 17h,0
MOVWF 06h
CALL DelD
MOVF 18h,0
MOVWF 06h
CALL DelD
MOVF 19h,0
MOVWF 06h
CALL DelD
MOVF 1Ah,0
MOVWF 06h
CALL DelD
Movf 1Bh,0
MOVWF 06h
CALL DelD
MOVF 1Ch,0
MOVWF 06h
CALL DelD
MOVF 1Dh,0
MOVWF 06h
CALL DelD
MOVF 1Eh,0
MOVWF 06h
CALL DelD
MOVF 1Fh,0
MOVWF 06h
CALL DelD
MOVF 20h,0
MOVWF 06h
CALL DelD
MOVF 21h,0
MOVWF 06h
CALL DelD
MOVF 22h,0
MOVWF 06h
CALL DelD
MOVF 23h,0
MOVWF 06h
CALL DelD
MOVF 24h,0
MOVWF 06h
CALL DelD
MOVF 25h,0
MOVWF 06h
CALL DelD
MOVF 26h,0
MOVWF 06h
CALL DelD
MOVF 27h,0
MOVWF 06h
CALL DelD
MOVF 28h,0
MOVWF 06h
CALL DelD
RETURN

;SHIFT moves the data one place to the left to give the "movement"
; effect on the screen

Shift MOVF 12h,0 ;Move file 12h to W
MOVWF 11h ;Move W to file 11h
MOVF 13h,0 ;Move file 13h to W
MOVWF 12h ;Move W to file 12h
MOVF 14h,0 ;Move file 14h to W
MOVWF 13h ;Move W to file 13h
MOVF 15h,0 ;Move file 15h to W
MOVWF 14h ;Move W to file 14h
MOVF 16h,0
MOVWF 15h
MOVF 17h,0
MOVWF 16h
MOVF 18h,0
MOVWF 17h
MOVF 19h,0
MOVWF 18h
MOVF 1Ah,0
MOVWF 19h
MOVF 1Bh,0
MOVWF 1Ah
MOVF 1Ch,0
MOVWF 1Bh
MOVF 1Dh,0
MOVWF 1Ch
MOVF 1Eh,0
MOVWF 1Dh
MOVF 1Fh,0
MOVWF 1Eh
MOVF 20h,0
MOVWF 1Fh
MOVF 21h,0
MOVWF 20h
MOVF 22h,0
MOVWF 21h
MOVF 23h,0
MOVWF 22h
MOVF 24h,0
MOVWF 23h
MOVF 25h,0
MOVWF 24h
MOVF 26h,0
MOVWF 25h
MOVF 27h,0
MOVWF 26h
MOVF 28h,0
MOVWF 27h
RETURN

DelD DECFSZ 1Bh,1 ;Delay for viewing the
GOTO DelD ; column of LEDs
MOVLW 00h
MOVWF 06
Clk BSF 05,0 ;Clock the 4017 to
NOP ; the next output
BCF 05,0
RETURN

END
 

SgtWookie

Joined Jul 17, 2007
22,230
You used QUOTE tags instead of CODE tags.
The CODE button (#) is available on the advanced screen.

I straightend out most of the formatting mess that caused.
Lines where I changed things or don't know why things were changed are flagged with <-

Also, I put in blank lines to make it easier to keep track of which 5x7 character the code is for.

Rich (BB code):
Start     ORG 0x00          ;This sets up the ports 
          BSF 03,5
          MOVLW 00h
          MOVWF 05h
          MOVWF 06h
          BCF 03,5
          GOTO Run1

          ;Table1  holds the hex values for each column of LEDs

Table1    ADDWF 02h,1         ;Add W to Program Counter
          RETLW 00h
          RETLW 40h
          RETLW 40h
          RETLW 7Fh
          RETLW 40h
          RETLW 40h
          RETLW 00h
          RETLW 7Fh
          RETLW 49h
          RETLW 49h
          RETLW 41h
          RETLW 41h
          RETLW 00h
          RETLW 3Fh
          RETLW 40h
          RETLW 3Fh
          RETLW 40h
          RETLW 3Fh
          RETLW 00h
          RETLW 3Eh
          RETLW 41h
          RETLW 41h
          RETLW 41h
          RETLW 3Eh
          RETLW 00h
          RETLW 70h
          RETLW 0Eh
          RETLW 01h
          RETLW 0Eh
          RETLW 70h
          RETLW 00h
          RETLW 7Fh
          RETLW 00h
          RETLW 7Fh
          RETLW 10h
          RETLW 0Ch
          RETLW 02h
          RETLW 7Fh
          RETLW 00h
          RETLW 3Eh
          RETLW 41h
          RETLW 45h
          RETLW 45h
          RETLW 36h
          RETLW 00h
          RETLW 32h
          RETLW 49h
          RETLW 49h
          RETLW 49h
          RETLW 26h
          RETLW 00h
          RETLW 7Fh
          RETLW 00h
          RETLW 3Eh
          RETLW 41h
          RETLW 45h
          RETLW 45h
          RETLW 36h
          RETLW 00h
          RETLW 7Fh
          RETLW 10h
          RETLW 0Ch
          RETLW 02h
          RETLW 7Fh
          RETLW 00h
          RETLW 00h
          RETLW 00h
          RETLW 00h
          RETLW 0FFh

Run1      CLRF 11h          ;Clear the Ghost locations ready for starting 
          CLRF 12h
          CLRF 13h
          CLRF 14h
          CLRF 15h

          CLRF 16h
          CLRF 17h
          CLRF 18h
          CLRF 19h
          CLRF 1Ah

          CLRF 1Bh   ;<- was 0x1B
          CLRF 1Ch
          CLRF 1Dh   ;<- was 0x1D
          CLRF 1Eh
          CLRF 1Fh

          CLRF 20h
          CLRF 21h
          CLRF 22h
          CLRF 23h
          CLRF 24h

          CLRF 25h
          CLRF 26h
          CLRF 27h
          CLRF 28h
          CLRF 29h    ;<- Added location
          
          MOVLW 00
          MOVWF 2Ah   ;<-Huh?   ;File 2Ah is the jump value for table
Run2      MOVLW 40h
          MOVWF 29h   ;<-Huh?   ;File 29h counts the number of scans
          CALL Shift     ; and controls the 'run speed'
          INCF 2Ah,1
          MOVF 2Ah,0      ;Put jump value into W 
          CALL Table1
          MOVWF 2Bh      ;W contains table data - put it in 15h
          XORLW 0FFh     ;If table value is FF, 
          BTFSC 03,2        ; bit 2 of file 3 will be SET (=1)
          GOTO Run1       ;Start Table1 again
Run3      DECFSZ 29h,1    ;Scan the display 40h times
          GOTO Run4
          GOTO Run2
Run4      CALL Scan
          GOTO Run3

Scan      BSF 05,1          ;Reset 4017
          NOP
          BCF 05,1

          MOVF 11h,0        ; Output the data at the 5 Ghost
          MOVWF 06h         ; locations to the display
          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

          MOVF 16h,0
          MOVWF 06h
          CALL DelD
          MOVF 17h,0
          MOVWF 06h
          CALL DelD
          MOVF 18h,0
          MOVWF 06h
          CALL DelD
          MOVF 19h,0
          MOVWF 06h
          CALL DelD
          MOVF 1Ah,0
          MOVWF 06h
          CALL DelD

          Movf 1Bh,0
          MOVWF 06h
          CALL DelD
          MOVF 1Ch,0
          MOVWF 06h
          CALL DelD
          MOVF 1Dh,0
          MOVWF 06h
          CALL DelD
          MOVF 1Eh,0
          MOVWF 06h
          CALL DelD
          MOVF 1Fh,0
          MOVWF 06h
          CALL DelD

          MOVF 20h,0
          MOVWF 06h
          CALL DelD
          MOVF 21h,0
          MOVWF 06h
          CALL DelD
          MOVF 22h,0
          MOVWF 06h
          CALL DelD
          MOVF 23h,0
          MOVWF 06h
          CALL DelD
          MOVF 24h,0
          MOVWF 06h
          CALL DelD

          MOVF 25h,0
          MOVWF 06h
          CALL DelD
          MOVF 26h,0
          MOVWF 06h
          CALL DelD
          MOVF 27h,0
          MOVWF 06h
          CALL DelD
          MOVF 28h,0
          MOVWF 06h
          CALL DelD
          MOVF 29h,0   ;<- Added
          MOVWF 06h    ;<- Added
          CALL DelD    ;<- Added
          RETURN

       ;SHIFT moves the data one place to the left to give the 'movement'
       ;  effect on the screen

 Shift    MOVF 12h,0         ;Move file 12h to W
          MOVWF 11h         ;Move W to file 11h
          MOVF 13h,0         ;Move file 13h to W
          MOVWF 12h         ;Move W to file 12h
          MOVF 14h,0         ;Move file 14h to W
          MOVWF 13h         ;Move W to file 13h
          MOVF 15h,0         ;Move file 15h to W
          MOVWF 14h         ;Move W to file 14h

          MOVF 16h,0
          MOVWF 15h
          MOVF 17h,0
          MOVWF 16h
          MOVF 18h,0
          MOVWF 17h
          MOVF 19h,0
          MOVWF 18h
          MOVF 1Ah,0
          MOVWF 19h

          MOVF 1Bh,0
          MOVWF 1Ah
          MOVF 1Ch,0
          MOVWF 1Bh
          MOVF 1Dh,0
          MOVWF 1Ch
          MOVF 1Eh,0
          MOVWF 1Dh
          MOVF 1Fh,0
          MOVWF 1Eh

          MOVF 20h,0
          MOVWF 1Fh
          MOVF 21h,0
          MOVWF 20h
          MOVF 22h,0
          MOVWF 21h
          MOVF 23h,0
          MOVWF 22h
          MOVF 24h,0
          MOVWF 23h

          MOVF 25h,0
          MOVWF 24h
          MOVF 26h,0
          MOVWF 25h
          MOVF 27h,0
          MOVWF 26h
          MOVF 28h,0
          MOVWF 27h
          MOVF 29h,0       ;<- Added
          MOVWF 28h        ;<- Added
          RETURN

DelD      DECFSZ 1Bh,1      ;Delay for viewing the 
          GOTO DelD          ; column of LEDs
          MOVLW 00h
          MOVWF 06
          Clk BSF 05,0          ;Clock the 4017 to
          NOP             ; the next output
          BCF 05,0
          RETURN

          END
 

Thread Starter

Thediabloman

Joined Mar 11, 2008
16
The reason that I didnt have the 25th in the code is that I dont have one.
I know that I said that and I'm sorry.

I only use 3 4017, so I only have 9+8+8 pins to scan with.

I use MPLab, and the 1Bh, and 1Dh didnt turn red as it should, so I tried to use 0x1B and 0x1D.

The problem is that I dont really understand this code:
Rich (BB code):
          MOVLW 00
          MOVWF 2Ah   ;<-Huh?   ;File 2Ah is the jump value for table
Run2      MOVLW 40h
          MOVWF 29h   ;<-Huh?   ;File 29h counts the number of scans
          CALL Shift     ; and controls the 'run speed'
          INCF 2Ah,1
          MOVF 2Ah,0      ;Put jump value into W 
          CALL Table1
          MOVWF 2Bh      ;W contains table data - put it in 15h
          XORLW 0FFh     ;If table value is FF, 
          BTFSC 03,2        ; bit 2 of file 3 will be SET (=1)
          GOTO Run1       ;Start Table1 again
Run3      DECFSZ 29h,1    ;Scan the display 40h times
          GOTO Run4
          GOTO Run2
Run4      CALL Scan
          GOTO Run3
 

Thread Starter

Thediabloman

Joined Mar 11, 2008
16
Hey guys..

I really dont get why the code isnt working.
I have been starring on it for the last couple of hours, and still havnt found the problem. I use the same circuit as the link from the first post in this thread, and then I have extended the system over a 7x24 LED matrix.
The scanning proces is working fine, and the system is clocking the 4017, but the B-ports are constant low.

Somehow it is going trough the code and clocking, without giving the correct output on the Bpins.

Please people.. I'm desperate..

- Thediabloman -
 

n9352527

Joined Oct 14, 2005
1,198
This code:
Rich (BB code):
call  Table1
movwf 2Bh
Should really be:
Rich (BB code):
call  Table1
movwf 28h
28h is the last ghost location that holds the value for last column of the LED. The value is used to set port B and then shifted to the preceding ghost location (corresponding to the preceding column), before reading the next value from Table1. Because your original code store the value read from Table1 in location 2Bh, all ghost locations never get set during scanning and stay cleared (low) all the time.
 

n9352527

Joined Oct 14, 2005
1,198
You're welcome. I can't say for sure that's the only error. That error was the only one I found probably because that was the only one I was looking for.

Please let us know if it works.
 

Thread Starter

Thediabloman

Joined Mar 11, 2008
16
thanks for the help..
I didnt get to school last tuesday, so didnt get to try it out.
Now I changed the code, and burned it to the PIC.

When I tried the running light out, scans very fast, so that it is hard to see the running text, and it only writes one new collumn each time the text reaches the end of the 25 collums. And the maximum width of the text is 10 or 11 collums..
 

n9352527

Joined Oct 14, 2005
1,198
Tell me if I get this right, you are saying the text scans very fast acros the display.

What do you mean by "it only writes one new column each time the text reaches the end of the 25 columns"? A new column or a new letter?

And width of the text is 10 or 11 columns? Is that the width of one letter? Which letter?
 

Thread Starter

Thediabloman

Joined Mar 11, 2008
16
Sorry for the bad english.. I'm usually good at English, but my electronic-english is pretty bad.

Ya, the text scans very fast across the display, but its only 10 or 11 collumns wide.

Every time these 10 collums reach the end they start over to the right, but moved one collumn.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoooooxoooooxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxoxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxoxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxoooxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxoxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxoxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxoooooxxxxxxxxxx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xxxxxxxxxxxxxxoooooxoooooxxxoxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxoxxxxxxxooxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxoxxxxxxxoxoxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxoooxxxxxoxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxoxxxxxxxoxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxoxxxxxxxoxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxoooooxxxoxxxxxxxxxx
 

n9352527

Joined Oct 14, 2005
1,198
Don't be sorry, mine's certainly not much better than yours. I just wanted to fully understand what's going on, so I could look and find the problem easier.

How do you connect the other two 4017s? Where do their clock pins connected?
 
Top