Asm-code-check?

Discussion in 'Programmer's Corner' started by Thediabloman, Apr 15, 2008.

  1. Thediabloman

    Thread Starter Member

    Mar 11, 2008
    16
    0
  2. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    290
    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.
     
  3. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    215
    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
     
  4. SgtWookie

    Expert

    Jul 17, 2007
    22,194
    1,761
    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.
     
  5. Thediabloman

    Thread Starter Member

    Mar 11, 2008
    16
    0
    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.
     
  6. SgtWookie

    Expert

    Jul 17, 2007
    22,194
    1,761
    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.

    Code ( (Unknown Language)):
    1.        
    2. Start     ORG 0x00          ;This sets up the ports
    3.           BSF 03,5
    4.           MOVLW 00h
    5.           MOVWF 05h
    6.           MOVWF 06h
    7.           BCF 03,5
    8.           GOTO Run1
    9.  
    10.           ;Table1  holds the hex values for each column of LEDs
    11.  
    12. Table1    ADDWF 02h,1         ;Add W to Program Counter
    13.           RETLW 00h
    14.           RETLW 40h
    15.           RETLW 40h
    16.           RETLW 7Fh
    17.           RETLW 40h
    18.           RETLW 40h
    19.           RETLW 00h
    20.           RETLW 7Fh
    21.           RETLW 49h
    22.           RETLW 49h
    23.           RETLW 41h
    24.           RETLW 41h
    25.           RETLW 00h
    26.           RETLW 3Fh
    27.           RETLW 40h
    28.           RETLW 3Fh
    29.           RETLW 40h
    30.           RETLW 3Fh
    31.           RETLW 00h
    32.           RETLW 3Eh
    33.           RETLW 41h
    34.           RETLW 41h
    35.           RETLW 41h
    36.           RETLW 3Eh
    37.           RETLW 00h
    38.           RETLW 70h
    39.           RETLW 0Eh
    40.           RETLW 01h
    41.           RETLW 0Eh
    42.           RETLW 70h
    43.           RETLW 00h
    44.           RETLW 7Fh
    45.           RETLW 00h
    46.           RETLW 7Fh
    47.           RETLW 10h
    48.           RETLW 0Ch
    49.           RETLW 02h
    50.           RETLW 7Fh
    51.           RETLW 00h
    52.           RETLW 3Eh
    53.           RETLW 41h
    54.           RETLW 45h
    55.           RETLW 45h
    56.           RETLW 36h
    57.           RETLW 00h
    58.           RETLW 32h
    59.           RETLW 49h
    60.           RETLW 49h
    61.           RETLW 49h
    62.           RETLW 26h
    63.           RETLW 00h
    64.           RETLW 7Fh
    65.           RETLW 00h
    66.           RETLW 3Eh
    67.           RETLW 41h
    68.           RETLW 45h
    69.           RETLW 45h
    70.           RETLW 36h
    71.           RETLW 00h
    72.           RETLW 7Fh
    73.           RETLW 10h
    74.           RETLW 0Ch
    75.           RETLW 02h
    76.           RETLW 7Fh
    77.           RETLW 00h
    78.           RETLW 00h
    79.           RETLW 00h
    80.           RETLW 00h
    81.           RETLW 0FFh
    82.  
    83. Run1      CLRF 11h          ;Clear the Ghost locations ready for starting
    84.           CLRF 12h
    85.           CLRF 13h
    86.           CLRF 14h
    87.           CLRF 15h
    88.  
    89.           CLRF 16h
    90.           CLRF 17h
    91.           CLRF 18h
    92.           CLRF 19h
    93.           CLRF 1Ah
    94.  
    95.           CLRF 1Bh   ;<- was 0x1B
    96.           CLRF 1Ch
    97.           CLRF 1Dh   ;<- was 0x1D
    98.           CLRF 1Eh
    99.           CLRF 1Fh
    100.  
    101.           CLRF 20h
    102.           CLRF 21h
    103.           CLRF 22h
    104.           CLRF 23h
    105.           CLRF 24h
    106.  
    107.           CLRF 25h
    108.           CLRF 26h
    109.           CLRF 27h
    110.           CLRF 28h
    111.           CLRF 29h    ;<- Added location
    112.          
    113.           MOVLW 00
    114.           MOVWF 2Ah   ;<-Huh?   ;File 2Ah is the jump value for table
    115. Run2      MOVLW 40h
    116.           MOVWF 29h   ;<-Huh?   ;File 29h counts the number of scans
    117.           CALL Shift     ; and controls the 'run speed'
    118.           INCF 2Ah,1
    119.           MOVF 2Ah,0      ;Put jump value into W
    120.           CALL Table1
    121.           MOVWF 2Bh      ;W contains table data - put it in 15h
    122.           XORLW 0FFh     ;If table value is FF,
    123.           BTFSC 03,2        ; bit 2 of file 3 will be SET (=1)
    124.           GOTO Run1       ;Start Table1 again
    125. Run3      DECFSZ 29h,1    ;Scan the display 40h times
    126.           GOTO Run4
    127.           GOTO Run2
    128. Run4      CALL Scan
    129.           GOTO Run3
    130.  
    131. Scan      BSF 05,1          ;Reset 4017
    132.           NOP
    133.           BCF 05,1
    134.  
    135.           MOVF 11h,0        ; Output the data at the 5 Ghost
    136.           MOVWF 06h         ; locations to the display
    137.           CALL DelD
    138.           MOVF 12h,0
    139.           MOVWF 06h
    140.           CALL DelD
    141.           MOVF 13h,0
    142.           MOVWF 06h
    143.           CALL DelD
    144.           MOVF 14h,0
    145.           MOVWF 06h
    146.           CALL DelD
    147.           MOVF 15h,0
    148.           MOVWF 06h
    149.           CALL DelD
    150.  
    151.           MOVF 16h,0
    152.           MOVWF 06h
    153.           CALL DelD
    154.           MOVF 17h,0
    155.           MOVWF 06h
    156.           CALL DelD
    157.           MOVF 18h,0
    158.           MOVWF 06h
    159.           CALL DelD
    160.           MOVF 19h,0
    161.           MOVWF 06h
    162.           CALL DelD
    163.           MOVF 1Ah,0
    164.           MOVWF 06h
    165.           CALL DelD
    166.  
    167.           Movf 1Bh,0
    168.           MOVWF 06h
    169.           CALL DelD
    170.           MOVF 1Ch,0
    171.           MOVWF 06h
    172.           CALL DelD
    173.           MOVF 1Dh,0
    174.           MOVWF 06h
    175.           CALL DelD
    176.           MOVF 1Eh,0
    177.           MOVWF 06h
    178.           CALL DelD
    179.           MOVF 1Fh,0
    180.           MOVWF 06h
    181.           CALL DelD
    182.  
    183.           MOVF 20h,0
    184.           MOVWF 06h
    185.           CALL DelD
    186.           MOVF 21h,0
    187.           MOVWF 06h
    188.           CALL DelD
    189.           MOVF 22h,0
    190.           MOVWF 06h
    191.           CALL DelD
    192.           MOVF 23h,0
    193.           MOVWF 06h
    194.           CALL DelD
    195.           MOVF 24h,0
    196.           MOVWF 06h
    197.           CALL DelD
    198.  
    199.           MOVF 25h,0
    200.           MOVWF 06h
    201.           CALL DelD
    202.           MOVF 26h,0
    203.           MOVWF 06h
    204.           CALL DelD
    205.           MOVF 27h,0
    206.           MOVWF 06h
    207.           CALL DelD
    208.           MOVF 28h,0
    209.           MOVWF 06h
    210.           CALL DelD
    211.           MOVF 29h,0   ;<- Added
    212.           MOVWF 06h    ;<- Added
    213.           CALL DelD    ;<- Added
    214.           RETURN
    215.  
    216.        ;SHIFT moves the data one place to the left to give the 'movement'
    217.        ;  effect on the screen
    218.  
    219.  Shift    MOVF 12h,0         ;Move file 12h to W
    220.           MOVWF 11h         ;Move W to file 11h
    221.           MOVF 13h,0         ;Move file 13h to W
    222.           MOVWF 12h         ;Move W to file 12h
    223.           MOVF 14h,0         ;Move file 14h to W
    224.           MOVWF 13h         ;Move W to file 13h
    225.           MOVF 15h,0         ;Move file 15h to W
    226.           MOVWF 14h         ;Move W to file 14h
    227.  
    228.           MOVF 16h,0
    229.           MOVWF 15h
    230.           MOVF 17h,0
    231.           MOVWF 16h
    232.           MOVF 18h,0
    233.           MOVWF 17h
    234.           MOVF 19h,0
    235.           MOVWF 18h
    236.           MOVF 1Ah,0
    237.           MOVWF 19h
    238.  
    239.           MOVF 1Bh,0
    240.           MOVWF 1Ah
    241.           MOVF 1Ch,0
    242.           MOVWF 1Bh
    243.           MOVF 1Dh,0
    244.           MOVWF 1Ch
    245.           MOVF 1Eh,0
    246.           MOVWF 1Dh
    247.           MOVF 1Fh,0
    248.           MOVWF 1Eh
    249.  
    250.           MOVF 20h,0
    251.           MOVWF 1Fh
    252.           MOVF 21h,0
    253.           MOVWF 20h
    254.           MOVF 22h,0
    255.           MOVWF 21h
    256.           MOVF 23h,0
    257.           MOVWF 22h
    258.           MOVF 24h,0
    259.           MOVWF 23h
    260.  
    261.           MOVF 25h,0
    262.           MOVWF 24h
    263.           MOVF 26h,0
    264.           MOVWF 25h
    265.           MOVF 27h,0
    266.           MOVWF 26h
    267.           MOVF 28h,0
    268.           MOVWF 27h
    269.           MOVF 29h,0       ;<- Added
    270.           MOVWF 28h        ;<- Added
    271.           RETURN
    272.  
    273. DelD      DECFSZ 1Bh,1      ;Delay for viewing the
    274.           GOTO DelD          ; column of LEDs
    275.           MOVLW 00h
    276.           MOVWF 06
    277.           Clk BSF 05,0          ;Clock the 4017 to
    278.           NOP             ; the next output
    279.           BCF 05,0
    280.           RETURN
    281.  
    282.           END
    283.            
    284.  
     
  7. Thediabloman

    Thread Starter Member

    Mar 11, 2008
    16
    0
    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:
    Code ( (Unknown Language)):
    1.  
    2.           MOVLW 00
    3.           MOVWF 2Ah   ;<-Huh?   ;File 2Ah is the jump value for table
    4. Run2      MOVLW 40h
    5.           MOVWF 29h   ;<-Huh?   ;File 29h counts the number of scans
    6.           CALL Shift     ; and controls the 'run speed'
    7.           INCF 2Ah,1
    8.           MOVF 2Ah,0      ;Put jump value into W
    9.           CALL Table1
    10.           MOVWF 2Bh      ;W contains table data - put it in 15h
    11.           XORLW 0FFh     ;If table value is FF,
    12.           BTFSC 03,2        ; bit 2 of file 3 will be SET (=1)
    13.           GOTO Run1       ;Start Table1 again
    14. Run3      DECFSZ 29h,1    ;Scan the display 40h times
    15.           GOTO Run4
    16.           GOTO Run2
    17. Run4      CALL Scan
    18.           GOTO Run3
    19.  
     
  8. Thediabloman

    Thread Starter Member

    Mar 11, 2008
    16
    0
    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 -
     
  9. n9352527

    AAC Fanatic!

    Oct 14, 2005
    1,198
    5
    This code:
    Code ( (Unknown Language)):
    1.  
    2. call  Table1
    3. movwf 2Bh
    Should really be:
    Code ( (Unknown Language)):
    1. call  Table1
    2. 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.
     
  10. Thediabloman

    Thread Starter Member

    Mar 11, 2008
    16
    0
    Thanks alot man..
    Is that the only error?

    I will try that solution first thing tommorow morning.
     
  11. n9352527

    AAC Fanatic!

    Oct 14, 2005
    1,198
    5
    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.
     
  12. Thediabloman

    Thread Starter Member

    Mar 11, 2008
    16
    0
    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..
     
  13. n9352527

    AAC Fanatic!

    Oct 14, 2005
    1,198
    5
    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?
     
  14. Thediabloman

    Thread Starter Member

    Mar 11, 2008
    16
    0
    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
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxoooooxxxxxxxxxxx

    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoooooxoooooxxxoxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxoxxxxxxxoxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxoxxxxxxxoxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxoooxxxxxoxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxoxxxxxxxoxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxoxxxxxxxoxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxoxxxxoooooxxxoxxxxxxxxxx
     
  15. n9352527

    AAC Fanatic!

    Oct 14, 2005
    1,198
    5
    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?
     
Loading...