scrolling message display HELP!!!

Discussion in 'The Projects Forum' started by andrakis2, Nov 14, 2008.

  1. andrakis2

    Thread Starter New Member

    Nov 13, 2008
    8
    0
    Hi, I have this program I got From,
    http://hobby_elec.piclist.com/e_pic6_2.htm

    i have built the board after designing it and printing it and now i have a problem i made the multiplexer in backward so it scrolls the wrong way!!!

    i belive this should be fixable at the code level so what i need is to know how to change the code below to make it scroll the opisite way.

    here is the code i am using
    Code ( (Unknown Language)):
    1. [INDENT];************************************************* *******
    2. ;
    3. ; The signboard control processing
    4. ;
    5. ; Author : Seiichi Inoue
    6. ;************************************************* *******
    7. list p=pic16f84a
    8. include p16f84a.inc
    9. __config h'3ff2'
    10.  
    11. ;**************** Label Definition ********************
    12. lpcnt equ 0c ;Screen loop counter adr
    13. scrnidx equ 0d ;Screen data index adr
    14. w_save equ 0e ;W register save adr
    15. s_save equ 0f ;STATUS reg save adr
    16. scrnhd equ 10 ;Screen table head adr
    17. tm_cnt equ 20 ;Time adjust counter adr
    18. e_adr equ 21 ;EEPROM data adr
    19. e_check equ 22 ;EEPROM end check cnt adr
    20. s_loop equ 23 ;Screen data loop cnt adr
    21. s_index equ 24 ;Screen table index adr
    22. s_work equ 25 ;Screen data work area
    23.  
    24. ;************************
    25. ;* Time adjust *
    26. ;************************
    27. ;This data decides a scroll speed. Basic rate is 26msec.
    28. tm_adj equ 0c ;Time adjust(26msec x 12)
    29.  
    30.  
    31. ;************************
    32. ;* EEPROM data size *
    33. ;************************
    34. ;If the data size is 30 bytes, then simply set d'30'.
    35. e_size equ d'32' ;EEPROM data size
    36.  
    37. ;*************** EEPROM Data Definition ***************
    38. org h'2100'
    39. de b'11111111'
    40. de b'01111000'
    41. de b'10111111'
    42. de b'11011111'
    43. de b'10111111'
    44. de b'01111000'
    45. de b'11111111'
    46. de b'11111111'
    47. de b'11000011'
    48. de b'10111101'
    49. de b'01111110'
    50. de b'00000000'
    51. de b'11111111'
    52. de b'01110110'
    53. de b'01110110'
    54. de b'00000000'
    55. de b'11111111'
    56. de b'00000110'
    57. de b'01110110'
    58. de b'01110000'
    59. de b'11111111'
    60. de b'10000001'
    61. de b'01111110'
    62. de b'10000001'
    63. de b'11111111'
    64. de b'01111111'
    65. de b'01111111'
    66. de b'00000000'
    67. de b'11111111'
    68. de b'10011001'
    69. de b'01111110'
    70. de b'10000001'
    71.  
    72. ;**************** Program Start ***********************
    73. org 0 ;Reset Vector
    74. goto init
    75. org 4 ;Interrupt Vector
    76. goto int
    77.  
    78. ;**************** Initial Process *********************
    79. org 5
    80. init bsf STATUS,RP0 ;Change to Bank1
    81. clrf TRISA ;Set PORTA to Output mode
    82. clrf TRISB ;Set PORTB to Output mode
    83. movlw h'07' ;TOCS=0,PSA=0,PS2/1/0=111
    84. movwf OPTION_REG ;Set timer condition
    85. bcf STATUS,RP0 ;Change to Bank0
    86. movlw h'00' ;Set timer value
    87. movwf TMR0 ;TMR0 = 0 (255 counts)
    88. movlw tm_adj ;Set time adjust value
    89. movwf tm_cnt ;Save time adjust
    90. clrf e_adr ;Clear EEPROM data adr
    91. movlw e_size ;Set EEPROM data size
    92. movwf e_check ;Save EEPROM end check
    93. movlw h'a0' ;GIE=1,TOIE=1
    94. movwf INTCON ;Interruption enable
    95.  
    96. ;************** Screen Load Process *******************
    97. screen bsf INTCON,GIE ;Interrupt enable
    98. movlw d'16' ;Set loop count
    99. movwf lpcnt ;Save loop count
    100. movlw h'0f' ;Set screen index
    101. movwf scrnidx ;Save index
    102. bcf INTCON,GIE ;Interrupt disable
    103. scrnlp movlw h'ff' ;Set LED OFF data
    104. movwf PORTB ;Output Data
    105. movf scrnidx,w ;Set Position
    106. movwf PORTA ;Output Position
    107. movlw scrnhd ;Set Table head address
    108. addwf scrnidx,w ;Head + Index
    109. movwf FSR ;Set Table address
    110. movf INDF,w ;Read Data
    111. movwf PORTB ;Output Data
    112. decf scrnidx,f ;Index - 1
    113. decfsz lpcnt,f ;Loop end ?
    114. goto scrnlp ;No. Next line
    115. goto screen ;Yes. Next screen
    116.  
    117. ;************ Begin Interruption Process **************
    118. int movwf w_save ;Save W register
    119. movf STATUS,w ;Read STATUS reg
    120. movwf s_save ;Save STATUS reg
    121. btfsc INTCON,T0IF ;Time out interruption ?
    122. goto timer_int ;Jump to Timer process
    123. goto init ;Reset(Illegal interrupt)
    124.  
    125. ;************ END of Interruption Process **************
    126. int_end movf s_save,w ;Read saved STATUS reg
    127. movwf STATUS ;Recover STATUS reg
    128. swapf w_save,f ;Read saved W register
    129. swapf w_save,w ;Recover W register
    130. retfie
    131.  
    132. ;*********** Time-out interruption Process ************
    133. timer_int
    134. bcf INTCON,T0IF ;Clear timer int flag
    135. movlw h'00' ;Set timer value
    136. movwf TMR0 ;TMR0 = 0 (255 counts)
    137. decfsz tm_cnt,f ;Time over ?
    138. goto int_end ;No. Retry
    139. movlw tm_adj ;Set time adjust value
    140. movwf tm_cnt ;Save time adjust
    141.  
    142. [COLOR=Red];************ Screen data shift Process ***************
    143. movlw d'15' ;Set loop count
    144. movwf s_loop ;Save loop count
    145. movlw scrnhd ;Set screen head adr
    146. movwf s_index ;Set screen adr
    147. loop incf s_index,w ;Inclement index
    148. movwf FSR ;Set read addres
    149. movf INDF,w ;Read data
    150. movwf s_work ;Save data
    151. movf s_index,w ;Read index
    152. movwf FSR ;Set write address
    153. movf s_work,w ;Recover data
    154. movwf INDF ;Write data
    155. incf s_index,f ;Inclement index
    156. decfsz s_loop,f ;All shifted ?
    157. goto loop ;No. Continue.[/COLOR]
    158.  
    159. [COLOR=Lime];i belive this is where the message moves[/COLOR]
    160.  
    161. ;************** New data write Process ****************
    162. movf s_index,w ;Read index
    163. movwf FSR ;Set write address
    164. movf e_adr,w ;Read EEPROM address
    165. movwf EEADR ;Set EEPROM address
    166. bsf STATUS,RP0 ;Change to Bank1
    167. bsf EECON1,RD ;Start EEPROM reading
    168. bcf STATUS,RP0 ;Change to Bank0
    169. movf EEDATA,w ;Read EEPROM data
    170. movwf INDF ;Write new data
    171. incf e_adr,f ;Inclement data address
    172. decfsz e_check,f ;End of EEPROM data ?
    173. goto int_end ;No. Return
    174. clrf e_adr ;Clear EEPROM data adr
    175. movlw e_size ;Set EEPROM data size
    176. movwf e_check ;Save EEPROM end check
    177. goto int_end ;Return
    178.  
    179. ;************************************************* *******
    180. ; END of signboard control processing
    181. ;************************************************* *******
    182.  
    183. end[/INDENT]

    any help would be appreciated i am very new to this
     
    Last edited by a moderator: Nov 14, 2008
  2. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    You have two choices here - get the multiplexer corrected or change the code.

    You may have found the part of the code that does the scrolling. If you have identified it to that extent, why not do a bit of analysis and modify it to scroll in the other direction? Instead of INCrementing the address, DECrement it. Just change the start and finish values.

    You get to learn something about programming that way.
     
  3. andrakis2

    Thread Starter New Member

    Nov 13, 2008
    8
    0
    i tried just changing the commands to dec but the display jumps once and stops that was the first thing i tried b4 i noticed that the chip was wrong i cannot change the chip as it gp in a printed board without cutting the tracks
     
  4. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    What happens if you complement the address written to the multiplexer while leaving the rest of the code the same?

    hgmjr
     
  5. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    For the message to come out correctly you may need to reverse the order of the message pattern at the same time.

    hgmjr
     
  6. andrakis2

    Thread Starter New Member

    Nov 13, 2008
    8
    0
    as i said i am new to this i know how to change the message and speed i can guess a few things from the comments but that is it! Basicaly i am a newbie at programming i am good at electronics but that wont help much with the computer parts
     
  7. andrakis2

    Thread Starter New Member

    Nov 13, 2008
    8
    0
    i can make it look right if i turn it upside down.:) sorry for the bad grammer i actually access this site from my mobile phone
     
  8. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    It looks like the message that you are scrolling is the word "CLOSED !". Am I correct?

    hgmjr
     
  9. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    Actually, what is so bad about mounting the board upsided down?

    I expect that you are going to house it in a box of some sort.


    If you change the pattern as I have indicated and then complement the 4-bit value that the PIC is feeding to the multiplexer, I think you will get the desired behaviour.

    hgmjr

    OLD PATTERN

    Code ( (Unknown Language)):
    1.  
    2. ;*************** EEPROM Data Definition ***************
    3. org h'2100'
    4. de b'11111111'
    5. de b'00011100'
    6. de b'11111101'
    7. de b'11111011'
    8. de b'11111101'
    9. de b'01111000'
    10. de b'11111111'
    11. de b'11111111'
    12. de b'11000011'
    13. de b'10111101'
    14. de b'01111110'
    15. de b'00000000'
    16. de b'11111111'
    17. de b'01110110'
    18. de b'01110110'
    19. de b'00000000'
    20. de b'11111111'
    21. de b'00000110'
    22. de b'01110110'
    23. de b'01110000'
    24. de b'11111111'
    25. de b'10000001'
    26. de b'01111110'
    27. de b'10000001'
    28. de b'11111111'
    29. de b'01111111'
    30. de b'01111111'
    31. de b'00000000'
    32. de b'11111111'
    33. de b'10011001'
    34. de b'01111110'
    35. de b'10000001'
    36.  
    NEW PATTERN

    Code ( (Unknown Language)):
    1.  
    2. org h'2100'
    3. [SIZE=2]de b'10000001'[/SIZE]
    4. [SIZE=2]de b'01111110'[/SIZE]
    5. [SIZE=2]de b'10011001'[/SIZE]
    6. [SIZE=2]de b'11111111'[/SIZE]
    7. [SIZE=2]de b'00000000'[/SIZE]
    8. [SIZE=2]de b'11111110'[/SIZE]
    9. [SIZE=2]de b'11111110'[/SIZE]
    10. [SIZE=2]de b'11111111'[/SIZE]
    11. [SIZE=2]de b'10000001'[/SIZE]
    12. [SIZE=2]de b'01111110'[/SIZE]
    13. [SIZE=2]de b'10000001'[/SIZE]
    14. [SIZE=2]de b'11111111'[/SIZE]
    15. [SIZE=2]de b'00001110'[/SIZE]
    16. [SIZE=2]de b'01101110'[/SIZE]
    17. [SIZE=2]de b'01100000'[/SIZE]
    18. [SIZE=2]de b'11111111'[/SIZE]
    19. [SIZE=2]de b'00000000'[/SIZE]
    20. [SIZE=2]de b'01110110'[/SIZE]
    21. [SIZE=2]de b'01110110'[/SIZE]
    22. [SIZE=2]de b'11111111'[/SIZE]
    23. [SIZE=2]de b'00000000'[/SIZE]
    24. [SIZE=2]de b'01111110'[/SIZE]
    25. [SIZE=2]de b'10111101'[/SIZE]
    26. [SIZE=2]de b'11000011'[/SIZE]
    27. [SIZE=2]de b'11111111'[/SIZE]
    28. [SIZE=2]de b'11111111'[/SIZE]
    29. [SIZE=2]de b'00011110'[/SIZE]
    30. [SIZE=2]de b'11111101'[/SIZE]
    31. [SIZE=2]de b'11111011'[/SIZE]
    32. [SIZE=2]de b'11111101'[/SIZE]
    33. [SIZE=2]de b'00011110'[/SIZE]
    34. [SIZE=2]de b'11111111'[/SIZE]
    35. [SIZE=2];****************[/SIZE]
    36.  
    37.  
     
    Last edited: Nov 15, 2008
  10. andrakis2

    Thread Starter New Member

    Nov 13, 2008
    8
    0
    thanks for that the new pattern is actualy what I put in to make it look right when its upside down
     
  11. andrakis2

    Thread Starter New Member

    Nov 13, 2008
    8
    0
    and what line do i compliment???
    and how do i compliment????
     
  12. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    Code ( (Unknown Language)):
    1.  
    2. [INDENT];**********************************************
    3. ;
    4. ; The signboard control processing
    5. ;
    6. ; Author : Seiichi Inoue
    7. ;**********************************************
    8. list p=pic16f84a
    9. include p16f84a.inc
    10. __config h'3ff2'
    11.  
    12. ;************* Label Definition ********************
    13. lpcnt    equ 0c    ;Screen loop counter adr
    14. scrnidx  equ 0d    ;Screen data index adr
    15. w_save   equ 0e    ;W register save adr
    16. s_save   equ 0f    ;STATUS reg save adr
    17. scrnhd   equ 10    ;Screen table head adr
    18. tm_cnt   equ 20    ;Time adjust counter adr
    19. e_adr    equ 21    ;EEPROM data adr
    20. e_check  equ 22    ;EEPROM end check cnt adr
    21. s_loop   equ 23    ;Screen data loop cnt adr
    22. s_index  equ 24    ;Screen table index adr
    23. s_work   equ 25    ;Screen data work area
    24.  
    25. ;************************
    26. ;* Time adjust *
    27. ;************************
    28. ;This data decides a scroll speed. Basic rate is 26msec.
    29. tm_adj   equ 0c ;Time adjust(26msec x 12)
    30.  
    31.  
    32. ;************************
    33. ;* EEPROM data size *
    34. ;************************
    35. ;If the data size is 30 bytes, then simply set d'30'.
    36. e_size   equ d'32' ;EEPROM data size
    37.  
    38. ;*************** EEPROM Data Definition ***************
    39. org h'2100'
    40. de b'11111111'
    41. de b'01111000'
    42. de b'10111111'
    43. de b'11011111'
    44. de b'10111111'
    45. de b'01111000'
    46. de b'11111111'
    47. de b'11111111'
    48. de b'11000011'
    49. de b'10111101'
    50. de b'01111110'
    51. de b'00000000'
    52. de b'11111111'
    53. de b'01110110'
    54. de b'01110110'
    55. de b'00000000'
    56. de b'11111111'
    57. de b'00000110'
    58. de b'01110110'
    59. de b'01110000'
    60. de b'11111111'
    61. de b'10000001'
    62. de b'01111110'
    63. de b'10000001'
    64. de b'11111111'
    65. de b'01111111'
    66. de b'01111111'
    67. de b'00000000'
    68. de b'11111111'
    69. de b'10011001'
    70. de b'01111110'
    71. de b'10000001'
    72.  
    73. ;**************** Program Start ***********************
    74. org      0         ;Reset Vector
    75.          goto init
    76. org      4         ;Interrupt Vector
    77.          goto int
    78.  
    79. ;**************** Initial Process *****************
    80. org      5
    81. init     bsf     STATUS,RP0 ;Change to Bank1
    82.          clrf    TRISA      ;Set PORTA to Output mode
    83.          clrf    TRISB      ;Set PORTB to Output mode
    84.          movlw   h'07'      ;TOCS=0,PSA=0,PS2/1/0=111
    85.          movwf   OPTION_REG ;Set timer condition
    86.          bcf     STATUS,RP0 ;Change to Bank0
    87.          movlw   h'00'      ;Set timer value
    88.          movwf   TMR0       ;TMR0 = 0 (255 counts)
    89.          movlw   tm_adj     ;Set time adjust value
    90.          movwf   tm_cnt     ;Save time adjust
    91.          clrf    e_adr      ;Clear EEPROM data adr
    92.          movlw   e_size     ;Set EEPROM data size
    93.          movwf   e_check    ;Save EEPROM end check
    94.          movlw   h'a0'      ;GIE=1,TOIE=1
    95.          movwf   INTCON     ;Interruption enable
    96.  
    97. ;************** Screen Load Process  *************
    98. screen   bsf     INTCON,GIE ;Interrupt enable
    99.          movlw   d'16'      ;Set loop count
    100.          movwf   lpcnt      ;Save loop count
    101.          movlw   h'0f'      ;Set screen index
    102.          movwf   scrnidx    ;Save index
    103.          bcf     INTCON,GIE ;Interrupt disable
    104. scrnlp   movlw   h'ff'      ;Set LED OFF data
    105.          movwf   PORTB      ;Output Data
    106.          movf    scrnidx,w  ;Set Position
    107.          movwf   PORTA      ;Output Position
    108.          movlw   scrnhd     ;Set Table head address
    109.          addwf   scrnidx,w  ;Head + Index
    110.          movwf   FSR        ;Set Table address
    111.          movf    INDF,w     ;Read Data
    112.          movwf   PORTB      ;Output Data
    113.          decf    scrnidx,f  ;Index - 1
    114.          decfsz  lpcnt,f    ;Loop end ?
    115.          goto    scrnlp     ;No. Next line
    116.          goto    screen     ;Yes. Next screen
    117.  
    118. ;********** Begin Interruption Process **************
    119. int      movwf   w_save      ;Save W register
    120.          movf    STATUS,w    ;Read STATUS reg
    121.          movwf   s_save      ;Save STATUS reg
    122.          btfsc   INTCON,T0IF ;Time out interruption ?
    123.          goto    timer_int   ;Jump to Timer process
    124.          goto    init        ;Reset(Illegal interrupt)
    125.  
    126. ;********* END of Interruption Process **************
    127. int_end  movf    s_save,w   ;Read saved STATUS reg
    128.          movwf   STATUS     ;Recover STATUS reg
    129.          swapf   w_save,f   ;Read saved W register
    130.          swapf   w_save,w   ;Recover W register
    131.          retfie
    132.  
    133. ;*********** Time-out interruption Process ************
    134. timer_int
    135.          bcf     INTCON,T0IF ;Clear timer int flag
    136.          movlw   h'00'       ;Set timer value
    137.          movwf   TMR0        ;TMR0 = 0 (255 counts)
    138.          decfsz  tm_cnt,f    ;Time over ?
    139.          goto    int_end     ;No. Retry
    140.          movlw   tm_adj      ;Set time adjust value
    141.          movwf   tm_cnt      ;Save time adjust
    142.  
    143. [COLOR=red];********** Screen data shift Process ***************[/COLOR]
    144. [COLOR=red]       movlw   d'15'     ;Set loop count[/COLOR]
    145. [COLOR=red]       movwf   s_loop    ;Save loop count[/COLOR]
    146. [COLOR=red]       movlw   scrnhd    ;Set screen head adr[/COLOR]
    147. [COLOR=red]       movwf   s_index   ;Set screen adr[/COLOR]
    148. [COLOR=red]loop   incf    s_index,w ;Inclement index[/COLOR]
    149. [COLOR=red]       movwf   FSR       ;Set read addres[/COLOR]
    150. [COLOR=red]       movf    INDF,w    ;Read data[/COLOR]
    151. [COLOR=red]       movwf   s_work    ;Save data[/COLOR]
    152. [COLOR=red]       movf    s_index,w ;Read index[/COLOR]
    153. [COLOR=red]       movwf   FSR       ;Set write address[/COLOR]
    154. [COLOR=red]       movf    s_work,w  ;Recover data[/COLOR]
    155. [COLOR=red]       movwf   INDF      ;Write data[/COLOR]
    156. [COLOR=red]       incf    s_index,f ;Inclement index[/COLOR]
    157. [COLOR=red]       decfsz  s_loop,f  ;All shifted ?[/COLOR]
    158. [COLOR=red]       goto    loop      ;No. Continue.[/COLOR]
    159.  
    160. [COLOR=seagreen];i believe this is where the message moves[/COLOR]
    161.  
    162. ;************New data write Process****************
    163.          movf    s_index,w  ;Read index
    164.          movwf   FSR        ;Set write address
    165.          movf    e_adr,w    ;Read EEPROM address
    166.          movwf   EEADR      ;Set EEPROM address
    167.          bsf     STATUS,RP0 ;Change to Bank1
    168.          bsf     EECON1,RD  ;Start EEPROM reading
    169.          bcf     STATUS,RP0 ;Change to Bank0
    170.          movf    EEDATA,w   ;Read EEPROM data
    171.          movwf   INDF       ;Write new data
    172.          incf    e_adr,f    ;Inclement data address
    173.          decfsz  e_check,f  ;End of EEPROM data ?
    174.          goto    int_end    ;No. Return
    175.          clrf    e_adr      ;Clear EEPROM data adr
    176.          movlw   e_size     ;Set EEPROM data size
    177.          movwf   e_check    ;Save EEPROM end check
    178.          goto     int_end    ;Return
    179.  
    180. ;*****************************************************
    181. ; END of signboard control processing
    182. ;******************************************************
    183.  
    184. end
    185. [/INDENT]
    I cleaned up the code to see if that would make it clearer to those with more experience in the PIC programming than I.

    hgmjr
     
    Last edited: Nov 15, 2008
  13. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    The code insert contains the added line highlighted in RED. This line does nothing more than invert the 4-bit value right before it is written to PORTA. The only other change that is likely to be needed is the pattern table for the message will need to be mirrored.

    As far as I can tell, all of the heavy lifting is being performed by the Timer 0 Interrupt Service Routine. There is only one place where PORTA is being updated. By inverting the value written to PORTA, the net effect should be a change in the direction that the display is scrolling. If this works as I expect then you may want to add a bit more code so that you can change the direction of scrolling at will by assigning an unused pin to select the scroll direction.

    hgmjr

    Code ( (Unknown Language)):
    1.  
    2. [INDENT];**********************************************
    3. ;
    4. ; The signboard control processing
    5. ;
    6. ; Author : Seiichi Inoue
    7. ;**********************************************
    8. list p=pic16f84a
    9. include p16f84a.inc
    10. __config h'3ff2'
    11.  
    12. ;************* Label Definition ********************
    13. lpcnt    equ 0c    ;Screen loop counter adr
    14. scrnidx  equ 0d    ;Screen data index adr
    15. w_save   equ 0e    ;W register save adr
    16. s_save   equ 0f    ;STATUS reg save adr
    17. scrnhd   equ 10    ;Screen table head adr
    18. tm_cnt   equ 20    ;Time adjust counter adr
    19. e_adr    equ 21    ;EEPROM data adr
    20. e_check  equ 22    ;EEPROM end check cnt adr
    21. s_loop   equ 23    ;Screen data loop cnt adr
    22. s_index  equ 24    ;Screen table index adr
    23. s_work   equ 25    ;Screen data work area
    24.  
    25. ;************************
    26. ;* Time adjust *
    27. ;************************
    28. ;This data decides a scroll speed. Basic rate is 26msec.
    29. tm_adj   equ 0c ;Time adjust(26msec x 12)
    30.  
    31.  
    32. ;************************
    33. ;* EEPROM data size *
    34. ;************************
    35. ;If the data size is 30 bytes, then simply set d'30'.
    36. e_size   equ d'32' ;EEPROM data size
    37.  
    38. ;*************** EEPROM Data Definition ***************
    39. org h'2100'
    40. de b'11111111'
    41. de b'01111000'
    42. de b'10111111'
    43. de b'11011111'
    44. de b'10111111'
    45. de b'01111000'
    46. de b'11111111'
    47. de b'11111111'
    48. de b'11000011'
    49. de b'10111101'
    50. de b'01111110'
    51. de b'00000000'
    52. de b'11111111'
    53. de b'01110110'
    54. de b'01110110'
    55. de b'00000000'
    56. de b'11111111'
    57. de b'00000110'
    58. de b'01110110'
    59. de b'01110000'
    60. de b'11111111'
    61. de b'10000001'
    62. de b'01111110'
    63. de b'10000001'
    64. de b'11111111'
    65. de b'01111111'
    66. de b'01111111'
    67. de b'00000000'
    68. de b'11111111'
    69. de b'10011001'
    70. de b'01111110'
    71. de b'10000001'
    72.  
    73. ;**************** Program Start ***********************
    74. org      0         ;Reset Vector
    75.          goto init
    76. org      4         ;Interrupt Vector
    77.          goto int
    78.  
    79. ;**************** Initial Process *****************
    80. org      5
    81. init     bsf     STATUS,RP0 ;Change to Bank1
    82.          clrf    TRISA      ;Set PORTA to Output mode
    83.          clrf    TRISB      ;Set PORTB to Output mode
    84.          movlw   h'07'      ;TOCS=0,PSA=0,PS2/1/0=111
    85.          movwf   OPTION_REG ;Set timer condition
    86.          bcf     STATUS,RP0 ;Change to Bank0
    87.          movlw   h'00'      ;Set timer value
    88.          movwf   TMR0       ;TMR0 = 0 (255 counts)
    89.          movlw   tm_adj     ;Set time adjust value
    90.          movwf   tm_cnt     ;Save time adjust
    91.          clrf    e_adr      ;Clear EEPROM data adr
    92.          movlw   e_size     ;Set EEPROM data size
    93.          movwf   e_check    ;Save EEPROM end check
    94.          movlw   h'a0'      ;GIE=1,TOIE=1
    95.          movwf   INTCON     ;Interruption enable
    96.  
    97. ;************** Screen Load Process  *************
    98. screen   bsf     INTCON,GIE ;Interrupt enable
    99.          movlw   d'16'      ;Set loop count
    100.          movwf   lpcnt      ;Save loop count
    101.          movlw   h'0f'      ;Set screen index
    102.          movwf   scrnidx    ;Save index
    103.          bcf     INTCON,GIE ;Interrupt disable
    104. scrnlp   movlw   h'ff'      ;Set LED OFF data
    105.          movwf   PORTB      ;Output Data
    106.          movf    scrnidx,w  ;Set Position
    107.          [COLOR=red][B]xorlw[/B][/COLOR]    [B][COLOR=red]h'ff'[/COLOR][/B]     [COLOR=red][B];Invert all of the bits of column address[/B][/COLOR]
    108. [COLOR=red][B]                           ; just prior to outputing the value to PORTA????[/B][/COLOR]  
    109.          movwf   PORTA      ;Output Position
    110.          movlw   scrnhd     ;Set Table head address
    111.          addwf   scrnidx,w  ;Head + Index
    112.          movwf   FSR        ;Set Table address
    113.          movf    INDF,w     ;Read Data
    114.          movwf   PORTB      ;Output Data
    115.          decf    scrnidx,f  ;Index - 1
    116.          decfsz  lpcnt,f    ;Loop end ?
    117.          goto    scrnlp     ;No. Next line
    118.          goto    screen     ;Yes. Next screen
    119.  
    120. ;********** Begin Interruption Process **************
    121. int      movwf   w_save      ;Save W register
    122.          movf    STATUS,w    ;Read STATUS reg
    123.          movwf   s_save      ;Save STATUS reg
    124.          btfsc   INTCON,T0IF ;Time out interruption ?
    125.          goto    timer_int   ;Jump to Timer process
    126.          goto    init        ;Reset(Illegal interrupt)
    127.  
    128. ;********* END of Interruption Process **************
    129. int_end  movf    s_save,w   ;Read saved STATUS reg
    130.          movwf   STATUS     ;Recover STATUS reg
    131.          swapf   w_save,f   ;Read saved W register
    132.          swapf   w_save,w   ;Recover W register
    133.          retfie
    134.  
    135. ;*********** Time-out interruption Process ************
    136. timer_int
    137.          bcf     INTCON,T0IF ;Clear timer int flag
    138.          movlw   h'00'       ;Set timer value
    139.          movwf   TMR0        ;TMR0 = 0 (255 counts)
    140.          decfsz  tm_cnt,f    ;Time over ?
    141.          goto    int_end     ;No. Retry
    142.          movlw   tm_adj      ;Set time adjust value
    143.          movwf   tm_cnt      ;Save time adjust
    144.  
    145. [COLOR=red];********** Screen data shift Process ***************[/COLOR]
    146. [COLOR=red]movlw   d'15'     ;Set loop count[/COLOR]
    147. [COLOR=red]movwf   s_loop    ;Save loop count[/COLOR]
    148. [COLOR=red]movlw   scrnhd    ;Set screen head adr[/COLOR]
    149. [COLOR=red]movwf   s_index   ;Set screen adr[/COLOR]
    150. [COLOR=red]loop   incf    s_index,w ;Inclement index[/COLOR]
    151. [COLOR=red]movwf   FSR       ;Set read addres[/COLOR]
    152. [COLOR=red]movf    INDF,w    ;Read data[/COLOR]
    153. [COLOR=red]movwf   s_work    ;Save data[/COLOR]
    154. [COLOR=red]movf    s_index,w ;Read index[/COLOR]
    155. [COLOR=red]movwf   FSR       ;Set write address[/COLOR]
    156. [COLOR=red]movf    s_work,w  ;Recover data[/COLOR]
    157. [COLOR=red]movwf   INDF      ;Write data[/COLOR]
    158. [COLOR=red]incf    s_index,f ;Inclement index[/COLOR]
    159. [COLOR=red]decfsz  s_loop,f  ;All shifted ?[/COLOR]
    160. [COLOR=red]goto    loop      ;No. Continue.[/COLOR]
    161.  
    162. [COLOR=seagreen];i believe this is where the message moves[/COLOR]
    163.  
    164. ;************New data write Process****************
    165.          movf    s_index,w  ;Read index
    166.          movwf   FSR        ;Set write address
    167.          movf    e_adr,w    ;Read EEPROM address
    168.          movwf   EEADR      ;Set EEPROM address
    169.          bsf     STATUS,RP0 ;Change to Bank1
    170.          bsf     EECON1,RD  ;Start EEPROM reading
    171.          bcf     STATUS,RP0 ;Change to Bank0
    172.          movf    EEDATA,w   ;Read EEPROM data
    173.          movwf   INDF       ;Write new data
    174.          incf    e_adr,f    ;Inclement data address
    175.          decfsz  e_check,f  ;End of EEPROM data ?
    176.          goto    int_end    ;No. Return
    177.          clrf    e_adr      ;Clear EEPROM data adr
    178.          movlw   e_size     ;Set EEPROM data size
    179.          movwf   e_check    ;Save EEPROM end check
    180.          goto     int_end    ;Return
    181.  
    182. ;*****************************************************
    183. ; END of signboard control processing
    184. ;******************************************************
    185.  
    186. end
    187. [/INDENT]
     
    Last edited: Nov 16, 2008
  14. andrakis2

    Thread Starter New Member

    Nov 13, 2008
    8
    0
    thank you that works the message is backward but i know how to change that myself
     
  15. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    I am glad I was able to help out.

    hgmjr
     
  16. SimoN15

    New Member

    Dec 19, 2010
    5
    0
    where did you get the old code pattern? based on the original code pattern, there was a slight difference between of them.
     
Loading...